Skip to content

Commit d0dc150

Browse files
committed
automatically merge to release branch when version number is incremented, hopefully
1 parent 3b1735a commit d0dc150

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

.github/workflows/release.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
6+
name: Update release branch if version incremented
7+
jobs:
8+
check-version:
9+
name: "Check version"
10+
runs-on: ubuntu-latest
11+
outputs:
12+
output1: ${{ steps.bumped.outputs.test }}
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Check if version bumped in package.json
16+
id: bumped
17+
run: '
18+
if [ \
19+
$(git blame -l package.json | grep "\"version\":" | cut -d " " -f 1) \
20+
= \
21+
$(git rev-parse HEAD) \
22+
]; then
23+
echo 0 > $GITHUB_OUTPUT
24+
else
25+
echo 1 > $GITHUB_OUTPUT
26+
fi
27+
'
28+
push-branch:
29+
name: "Push branch"
30+
needs: check-version
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v4
34+
- name: Push release branch
35+
env:
36+
OUTPUT: ${{needs.bumped.outputs.output1}}
37+
run: '
38+
[ "$OUTPUT" = "0" ] &&
39+
git branch -f release &&
40+
git push -f origin release
41+
'

0 commit comments

Comments
 (0)