generated from openshift/console-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 4
45 lines (37 loc) · 1.41 KB
/
bump.yaml
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
name: Bump Version
on:
workflow_dispatch: # Manual trigger
jobs:
bump-version:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install jq
run: sudo apt-get install -y jq
- name: Bump version in package.json
id: bump_version
run: |
# Get the current version
CURRENT_VERSION=$(jq -r '.version' package.json)
echo "Current version: $CURRENT_VERSION"
# Increment the patch version
IFS='.' read -r major minor patch <<< "$CURRENT_VERSION"
NEW_VERSION="$major.$minor.$((patch + 1))"
echo "New version: $NEW_VERSION"
# Update the version fields in package.json
jq ".version = \"$NEW_VERSION\" | .consolePlugin.version = \"$NEW_VERSION\"" package.json > package.json.tmp
mv package.json.tmp package.json
- name: Commit and push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add package.json
git commit -m "Bump version to ${{ steps.bump_version.outputs.new_version }}"
git push origin main