forked from theesfeld/CleanX
-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (52 loc) · 1.67 KB
/
release.yml
File metadata and controls
57 lines (52 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Release CleanX
on:
push:
branches: [main, master]
tags:
- 'v*'
jobs:
build-and-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Prepare artifacts
run: |
mkdir -p dist
cp CleanX-user.js dist/CleanX.user.js
cp -r extension dist/extension
# zip the extension for convenience
(cd dist && zip -r CleanX-extension.zip extension)
# changelog since last tag (or full log if none)
latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -n "$latest_tag" ]; then
range="${latest_tag}..HEAD"
else
range=""
fi
git log --no-merges --format="* %s (%h)" $range > dist/CHANGELOG.md
if [ ! -s dist/CHANGELOG.md ]; then
echo "* No recorded changes for this release (${GITHUB_REF##*/})." > dist/CHANGELOG.md
fi
- name: Upload build artifacts (main/master)
if: startsWith(github.ref, 'refs/heads/')
uses: actions/upload-artifact@v4
with:
name: cleanx-build-${{ github.run_id }}
path: |
dist/CleanX.user.js
dist/CleanX-extension.zip
dist/CHANGELOG.md
- name: Create Release (tags)
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: |
dist/CleanX.user.js
dist/CleanX-extension.zip
dist/CHANGELOG.md
body_path: dist/CHANGELOG.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}