Skip to content

Commit 23ade24

Browse files
authored
Merge pull request #5 from leinardi/master
Add release workflow
2 parents 0b380f3 + 961fd08 commit 23ade24

File tree

2 files changed

+60
-2
lines changed

2 files changed

+60
-2
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Any HTML comment will be stripped when the markdown is rendered, so you don't ne
55
### Pull request checklist
66

77
<!-- replace the empty checkboxes [ ] below with checked ones [x] accordingly -->
8-
9-
- [ ] I have **rebased** this branch on top of the destination branch (usually `master`)
8+
- [ ] I am targeting the `master` branch (and **not** the `release` branch)
9+
- [ ] I have **rebased** this branch on top of the destination branch
1010
- [ ] I have executed locally `make check` *before creating the commit* and it has run successfully
1111
- [ ] My contribution is fully baked and ready to be merged as is
1212
- [ ] I have performed a self-review of my own code

.github/workflows/release.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
semver:
7+
description: 'Release Semantic Versioning (e.g. 4.15.2)'
8+
required: true
9+
10+
jobs:
11+
release:
12+
name: Release
13+
runs-on: ubuntu-24.04
14+
timeout-minutes: 10
15+
env:
16+
TERM: dumb
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Create release tag
23+
uses: actions/github-script@v7
24+
with:
25+
github-token: ${{ secrets.GITHUB_TOKEN }}
26+
script: |
27+
github.rest.git.createRef({
28+
owner: context.repo.owner,
29+
repo: context.repo.repo,
30+
ref: "refs/tags/${{ github.event.inputs.semver }}",
31+
sha: context.sha
32+
})
33+
34+
- name: Workaround to fetch the tag # Is there a better way to do it?
35+
uses: actions/checkout@v4
36+
with:
37+
fetch-depth: 0
38+
39+
- name: Create GitHub release
40+
uses: softprops/action-gh-release@v2
41+
with:
42+
draft: true
43+
tag_name: ${{ github.event.inputs.semver }}
44+
generate_release_notes: true
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
48+
- name: Delete release tag
49+
if: ${{ failure() || cancelled() }}
50+
uses: actions/github-script@v7
51+
with:
52+
github-token: ${{ secrets.GITHUB_TOKEN }}
53+
script: |
54+
github.rest.git.deleteRef({
55+
owner: context.repo.owner,
56+
repo: context.repo.repo,
57+
ref: "tags/${{ github.event.inputs.semver }}"
58+
})

0 commit comments

Comments
 (0)