Skip to content

Commit 0c8bfcb

Browse files
authored
feat: [PTF-1962] CI-based post- main-branch-merge auto-release/versioning (#16)
* Implement CI-based (post merge) auto-release/version * Only run ci in the main branch * Prevent github. -.related errors (e.g. .head_ref vs .ref)
1 parent b67a278 commit 0c8bfcb

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

.github/workflows/ci.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ permissions:
66
on:
77
# for feature branches
88
pull_request:
9+
# for releases
10+
push:
11+
branches:
12+
- master
913

1014
concurrency:
1115
group: ${{ (github.ref != 'refs/heads/master') && format('{0}-{1}', github.ref, github.workflow) || github.run_id }}
@@ -60,3 +64,29 @@ jobs:
6064
env:
6165
HEAD_REF: ${{ github.head_ref }}
6266
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
67+
68+
release:
69+
if: github.ref == 'refs/heads/master' && startsWith(github.event.head_commit.message, 'no-release:') == false
70+
runs-on: ubuntu-24.04
71+
steps:
72+
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
73+
with:
74+
fetch-depth: 0
75+
token: ${{secrets.GITHUB_TOKEN}}
76+
77+
- name: Bump version and push tag
78+
id: tag-version
79+
uses: mathieudutour/github-tag-action@a22cf08638b34d5badda920f9daf6e72c477b07b # v6.2
80+
with:
81+
github_token: ${{ secrets.GITHUB_TOKEN }}
82+
dry_run: true
83+
release_branches: master
84+
85+
- name: Create a GitHub release
86+
run: |
87+
if ! command -v gh >/dev/null 2>&1; then
88+
curl -sS https://webi.sh/gh | sh
89+
fi
90+
gh release create ${{ steps.tag-version.outputs.new_tag }} --generate-notes --latest
91+
env:
92+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)