generated from openshift/console-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
290259e
commit becc9c2
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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 |