1- name : Release Drafter
1+ name : Release
22
33on :
4- push :
5- tags :
6- - " v*" # Only trigger when tags starting with 'v' are pushed
7-
8- permissions :
9- contents : write
4+ workflow_run :
5+ workflows : ["Build"]
6+ types :
7+ - completed
108
119jobs :
12- update_release_draft :
13- permissions :
14- contents : write # Required to create/update GitHub releases
15- pull-requests : write # Required for autolabeler
10+ changelog_release :
11+ if : ${{ github.event.workflow_run.conclusion == 'success' }}
1612 runs-on : ubuntu-latest
1713 steps :
18- # Drafts release notes when tags are pushed from release.sh
19- - uses : release-drafter/release-drafter@v6
14+ - uses : actions/checkout@v4
2015 with :
21- tag : ${{ github.ref_name }} # Use the pushed tag name
16+ fetch-depth : 0 # full history needed for changelog
17+
18+ - name : Install git-cliff
19+ run : |
20+ curl -sSL https://github.com/orhun/git-cliff/releases/download/v2.1.2/git-cliff-2.1.2-x86_64-unknown-linux-musl.tar.gz | tar xz
21+ sudo mv git-cliff /usr/local/bin/
22+
23+ - name : Generate CHANGELOG.md
24+ run : git-cliff -c git-cliff.toml -o CHANGELOG.md
25+
26+ - name : Commit and push CHANGELOG.md
27+ run : |
28+ git config --global user.email "bot@users.noreply.github.com"
29+ git config --global user.name "GitHub Actions Bot"
30+ git add CHANGELOG.md
31+ git commit -m "Update CHANGELOG.md for ${{ github.ref_name }}"
32+ git push
2233 env :
2334 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
35+
36+ - name : Download build artifacts
37+ uses : actions/download-artifact@v4
38+ with :
39+ path : artifacts
40+
41+ - name : Create GitHub Release
42+ uses : softprops/action-gh-release@v1
43+ with :
44+ tag_name : ${{ github.ref_name }}
45+ name : Release ${{ github.ref_name }}
46+ body_path : CHANGELOG.md
47+ draft : true
48+ files : artifacts/**/*
49+ prerelease : ${{ contains(github.ref_name, '-') }}
50+ env :
51+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments