Skip to content

Commit eaea522

Browse files
Adding script to pipeline to automatically bump version (#2)
### Changelog Added a script on the pipeline to automatically bump the version of the package when a new PR is merged to main
1 parent 8753c63 commit eaea522

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.github/workflows/bump-version.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Auto Bump Version
2+
3+
on:
4+
push:
5+
branches:
6+
- main # Trigger on push to main branch
7+
8+
jobs:
9+
bump:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
with:
15+
token: ${{ secrets.LICHTBLICK_GITHUB_TOKEN }}
16+
17+
- name: Set up Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: '18'
21+
22+
- run: corepack enable
23+
24+
- name: Cache yarn dependencies
25+
uses: actions/cache@v4
26+
with:
27+
path: |
28+
**/node_modules
29+
~/.cache/yarn
30+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
31+
restore-keys: |
32+
${{ runner.os }}-yarn-
33+
34+
- name: Install dependencies
35+
run: yarn install --mode skip-build
36+
env:
37+
YARN_ENABLE_IMMUTABLE_INSTALLS: false
38+
39+
- name: Set up Git
40+
run: |
41+
git config --global user.name 'github-actions'
42+
git config --global user.email '[email protected]'
43+
44+
- name: Bump version in root package.json
45+
run: yarn version --new-version patch --no-git-tag-version
46+
47+
- name: Commit version bumps
48+
id: commit_version_bumps
49+
run: |
50+
git add package.json yarn.lock
51+
git commit -m "chore: bump versions in root package.json [skip actions]"
52+
echo "commit_sha=$(git rev-parse HEAD)" >> $GITHUB_ENV
53+
54+
- name: Push changes
55+
run: |
56+
git push origin main

0 commit comments

Comments
 (0)