Last active
June 8, 2024 08:00
-
-
Save Makio64/50d884dca0ba73f77ae4269b49063e08 to your computer and use it in GitHub Desktop.
automatic update version on push ( create a new commit )
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
name: Update Version | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
workflow_dispatch: | |
jobs: | |
update-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Cache Node.js modules | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.npm | |
node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install dependencies | |
run: npm install | |
- name: Update version | |
run: npm run update-version | |
- name: Commit version update | |
run: | | |
git config --global user.email "example@gmail.com" | |
git config --global user.name "Example" | |
git add package.json | |
git commit -m "bump version to $(node -p "require('./package.json').version")" | |
git push origin master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment