File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Create GitHub release
2+
3+ on :
4+ push :
5+ tags :
6+ - " *"
7+
8+ permissions :
9+ contents : write
10+
11+ jobs :
12+ release :
13+ name : Release tagged mainline commit
14+ runs-on : ubuntu-latest
15+
16+ steps :
17+ - name : Check out repository history
18+ uses : actions/checkout@v4
19+ with :
20+ fetch-depth : 0
21+
22+ - name : Check whether the tag is on mainline
23+ id : tag-check
24+ env :
25+ TAG_NAME : ${{ github.ref_name }}
26+ shell : bash
27+ run : |
28+ git fetch --no-tags origin mainline
29+ tag_commit="$(git rev-list -n 1 "$TAG_NAME")"
30+
31+ if git merge-base --is-ancestor "$tag_commit" origin/mainline; then
32+ echo "on_mainline=true" >> "$GITHUB_OUTPUT"
33+ else
34+ echo "on_mainline=false" >> "$GITHUB_OUTPUT"
35+ echo "Tag $TAG_NAME does not point to a commit on mainline; skipping release."
36+ fi
37+
38+ - name : Create GitHub release
39+ if : steps.tag-check.outputs.on_mainline == 'true'
40+ env :
41+ GH_TOKEN : ${{ github.token }}
42+ TAG_NAME : ${{ github.ref_name }}
43+ run : gh release create "$TAG_NAME" --verify-tag --generate-notes --title "$TAG_NAME"
You can’t perform that action at this time.
0 commit comments