Skip to content

Commit

Permalink
Create bump.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmadigan authored Nov 14, 2024
1 parent 290259e commit becc9c2
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/bump.yaml
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

0 comments on commit becc9c2

Please sign in to comment.