11name : Release
22
33on :
4- workflow_dispatch :
4+ push :
5+ branches : [main]
56
67permissions :
78 contents : write
9+ pull-requests : write
810
911env :
1012 CXX : g++-14
1113
1214jobs :
13- changelog :
15+ bump :
1416 runs-on : ubuntu-24.04
1517 outputs :
16- skipped : ${{ steps.changelog.outputs.skipped }}
17- tag : ${{ steps.changelog.outputs.tag }}
18- clean_changelog : ${{ steps.changelog.outputs.clean_changelog }}
18+ release_created : ${{ steps.rp.outputs.release_created }}
19+ tag : ${{ steps.rp.outputs.tag_name }}
1920 steps :
20- - uses : actions/checkout@v4
21- with :
22- fetch-depth : 0 # Ensure we have all tags
23-
24- - name : Generate Conventional ChangeLog
25- uses : TriPSs/conventional-changelog-action@v6
26- id : changelog
21+ - uses : googleapis/release-please-action@v4
22+ id : rp
2723 with :
28- preset : " conventionalcommits"
29- tag-prefix : " "
30- output-file : " false"
31- version-file : " cabin.toml"
32- version-path : " package.version"
33- skip-git-pull : " true"
24+ token : ${{ secrets.RELEASE_PLEASE_TOKEN }}
25+ config-file : .github/release-please-config.json
26+ manifest-file : .github/.release-please-manifest.json
3427
3528 build :
36- needs : changelog
29+ needs : bump
30+ if : needs.bump.outputs.release_created == 'true'
3731 runs-on : ubuntu-24.04
3832 steps :
3933 - uses : actions/checkout@v4
4034 with :
41- ref : ${{ needs.changelog .outputs.tag }}
35+ ref : ${{ needs.bump .outputs.tag }}
4236
4337 - name : Setup Ubuntu dependencies
4438 uses : ./.github/actions/setup-ubuntu-deps
@@ -53,12 +47,13 @@ jobs:
5347 path : build/cabin
5448
5549 package :
56- needs : [changelog, build]
50+ needs : [bump, build]
51+ if : needs.bump.outputs.release_created == 'true'
5752 runs-on : ubuntu-24.04
5853 steps :
5954 - uses : actions/checkout@v4
6055 with :
61- ref : ${{ needs.changelog .outputs.tag }}
56+ ref : ${{ needs.bump .outputs.tag }}
6257
6358 - name : Download build artifact
6459 uses : actions/download-artifact@v4
@@ -78,28 +73,29 @@ jobs:
7873 - name : Create DEB package
7974 run : nfpm pkg --packager deb
8075 env :
81- CABIN_VERSION : ${{ needs.changelog .outputs.tag }}
76+ CABIN_VERSION : ${{ needs.bump .outputs.tag }}
8277
8378 - name : Create RPM package
8479 run : nfpm pkg --packager rpm
8580 env :
86- CABIN_VERSION : ${{ needs.changelog .outputs.tag }}
81+ CABIN_VERSION : ${{ needs.bump .outputs.tag }}
8782
8883 - name : Upload package artifacts
8984 uses : actions/upload-artifact@v4
9085 with :
91- name : packages
86+ name : rel- packages
9287 path : |
9388 *.deb
9489 *.rpm
9590
9691 demo :
97- needs : [changelog, build]
92+ needs : [bump, build]
93+ if : needs.bump.outputs.release_created == 'true'
9894 runs-on : ubuntu-24.04
9995 steps :
10096 - uses : actions/checkout@v4
10197 with :
102- ref : ${{ needs.changelog .outputs.tag }}
98+ ref : ${{ needs.bump .outputs.tag }}
10399
104100 - name : Download build artifact
105101 uses : actions/download-artifact@v4
@@ -165,54 +161,39 @@ jobs:
165161 - name : Upload demo artifact
166162 uses : actions/upload-artifact@v4
167163 with :
168- name : demo-gif
164+ name : rel-demo
169165 path : ${{ runner.temp }}/demo.gif
170166
171167 release :
172- needs : [changelog, package, demo]
168+ needs : [bump, package, demo]
169+ if : needs.bump.outputs.release_created == 'true'
173170 runs-on : ubuntu-24.04
174171 steps :
175172 - uses : actions/checkout@v4
176173 with :
177- ref : ${{ needs.changelog .outputs.tag }}
174+ ref : ${{ needs.bump .outputs.tag }}
178175
179- - name : Download package artifacts
180- uses : actions/download-artifact@v4
176+ - name : Prepend header to RP notes
177+ uses : actions/github-script@v7
181178 with :
182- name : packages
183-
184- - name : Download demo artifact
179+ script : |
180+ const tag = '${{ needs.bump.outputs.tag }}';
181+ const { owner, repo } = context.repo;
182+ const { data: rel } = await github.rest.repos.getReleaseByTag({ owner, repo, tag });
183+ const fs = require('fs');
184+ let header = fs.readFileSync('.github/release-header.md', 'utf8');
185+ header = header.replace(/\$\{TAG\}/g, tag);
186+ await github.rest.repos.updateRelease({
187+ owner, repo, release_id: rel.id,
188+ body: `${header}\n\n${rel.body ?? ''}`
189+ });
190+
191+ - name : Download release artifacts
185192 uses : actions/download-artifact@v4
186193 with :
187- name : demo-gif
188-
189- - name : Release
190- uses : softprops/action-gh-release@v2
191- with :
192- tag_name : ${{ needs.changelog.outputs.tag }}
193- draft : false
194- generate_release_notes : ${{ needs.changelog.outputs.skipped }}
195- files : |
196- *.deb
197- *.rpm
198- demo.gif
199- body : |
200- :sparkling_heart: I maintain **Cabin** in my spare time. Buy me a coffee on [GitHub Sponsors](https://github.com/sponsors/ken-matsui) so I can keep shipping features!
201-
202- ## Installation
203-
204- ### Ubuntu/Debian
205-
206- ```bash
207- wget https://github.com/cabinpkg/cabin/releases/download/${{ needs.changelog.outputs.tag }}/cabin_${{ needs.changelog.outputs.tag }}_amd64.deb
208- sudo dpkg -i cabin_${{ needs.changelog.outputs.tag }}_amd64.deb
209- ```
210-
211- ### RHEL/CentOS/Fedora
212-
213- ```bash
214- wget https://github.com/cabinpkg/cabin/releases/download/${{ needs.changelog.outputs.tag }}/cabin-${{ needs.changelog.outputs.tag }}-1.x86_64.rpm
215- sudo rpm -i cabin-${{ needs.changelog.outputs.tag }}-1.x86_64.rpm
216- ```
194+ pattern : rel-*
195+ path : artifacts/
196+ merge-multiple : true
217197
218- ${{ needs.changelog.outputs.clean_changelog }}
198+ - name : Upload release artifacts
199+ run : gh release upload '${{ needs.bump.outputs.tag }}' artifacts/* --clobber
0 commit comments