-
Notifications
You must be signed in to change notification settings - Fork 828
50 lines (41 loc) · 1.46 KB
/
chore-version-bump.yaml
File metadata and controls
50 lines (41 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Post-Release Version Bump
on:
release:
types: [published]
permissions: {}
jobs:
bump-version:
name: Bump Version
if: github.repository == 'zealdocs/zeal'
runs-on: ubuntu-latest
steps:
- name: Generate App Token
id: app-token
uses: actions/create-github-app-token@v3
with:
client-id: ${{ secrets.CI_APP_ID }}
private-key: ${{ secrets.CI_APP_PRIVATE_KEY }}
permission-contents: write
- name: Checkout
uses: actions/checkout@v6
with:
ref: main
token: ${{ steps.app-token.outputs.token }}
- name: Bump Version
run: |
version="${{ github.event.release.tag_name }}"
version="${version#v}"
# Increment patch version.
IFS='.' read -r major minor patch <<< "$version"
next_patch=$((patch + 1))
next_version="${major}.${minor}.${next_patch}"
sed -i "/^project(/,/^)/ s/${version}/${next_version}/" CMakeLists.txt
echo "NEXT_VERSION=${next_version}" >> $GITHUB_ENV
- name: Commit & Push
run: |
git config user.name "zealdocs-ci[bot]"
git config user.email "273095467+zealdocs-ci[bot]@users.noreply.github.com"
git add CMakeLists.txt
git diff --staged --quiet && echo "::error::Version bump failed, no changes detected." && exit 1
git commit -m "chore: bump version to ${{ env.NEXT_VERSION }}"
git push