-
Notifications
You must be signed in to change notification settings - Fork 600
52 lines (45 loc) · 1.55 KB
/
post-release-bump.yml
File metadata and controls
52 lines (45 loc) · 1.55 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
51
52
name: post-release-bump
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
bump-version-file:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
ref: main
token: ${{ secrets.GITHUB_TOKEN }}
- name: Compute next dev version
id: nextver
run: |
if ! [[ "$GITHUB_REF_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then
echo "::error::Invalid tag format: $GITHUB_REF_NAME"
exit 1
fi
# Policy: VERSION = "<just-pushed-tag>-dev". The just-pushed tag is
# the latest released version; -dev marks the period afterwards.
next="${GITHUB_REF_NAME}-dev"
printf 'next=%s\n' "$next" >> "$GITHUB_OUTPUT"
- name: Write VERSION
env:
NEXT_VERSION: ${{ steps.nextver.outputs.next }}
run: printf '%s\n' "$NEXT_VERSION" > internal/cmd/VERSION
- name: Commit & push
env:
NEXT_VERSION: ${{ steps.nextver.outputs.next }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
if git diff --quiet -- internal/cmd/VERSION; then
echo "VERSION unchanged, nothing to commit"
exit 0
fi
git add internal/cmd/VERSION
git commit -m "chore(release): bump VERSION to $NEXT_VERSION
[skip ci]"
git push origin main