Skip to content

Commit 41b2bec

Browse files
committed
Experiment with quicker way to bump versions before release
We're currently creating PRs to manage this which require approval. This semi-automates it and hopefully makes it less error prone
1 parent f4e2d63 commit 41b2bec

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

.github/workflows/bump-version.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Bump version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
level:
7+
description: Version bump level
8+
required: true
9+
type: choice
10+
default: patch
11+
options:
12+
- patch
13+
- minor
14+
- major
15+
16+
permissions:
17+
contents: write
18+
19+
jobs:
20+
bump-version:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Cache dependencies
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: 20
30+
cache: "yarn"
31+
registry-url: "https://npm.pkg.github.com"
32+
scope: "@RaspberryPiFoundation"
33+
34+
- name: Configure git
35+
run: |
36+
git config user.name "github-actions[bot]"
37+
git config user.email "github-actions[bot]@users.noreply.github.com"
38+
39+
- name: Bump version
40+
run: yarn version ${{ inputs.level }}
41+
42+
- name: Commit and push
43+
run: |
44+
if git diff --quiet; then
45+
echo "No changes to commit"
46+
exit 1
47+
fi
48+
49+
git add -A
50+
git commit -m "Bump version (${{ inputs.level }}) for release"
51+
git push origin HEAD:${{ github.ref_name }}

0 commit comments

Comments
 (0)