mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-05 13:57:10 -04:00
Create update-version-on-branch.yml
This commit is contained in:
parent
75516ef378
commit
513595d75e
1 changed files with 32 additions and 0 deletions
32
.github/workflows/update-version-on-branch.yml
vendored
Normal file
32
.github/workflows/update-version-on-branch.yml
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
name: Update Version on Branch Creation
|
||||
|
||||
on:
|
||||
create:
|
||||
# This will trigger the workflow when branches or tags are created.
|
||||
|
||||
jobs:
|
||||
update-version:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.ref_type == 'branch' && github.ref_name != 'main' && github.ref_name != 'master'
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Update package.json version
|
||||
run: |
|
||||
jq '.version = "${{ github.ref_name }}"' package.json > temp.json && mv temp.json package.json
|
||||
|
||||
- name: Commit and Push
|
||||
run: |
|
||||
git config --global user.email "action@github.com"
|
||||
git config --global user.name "GitHub Action"
|
||||
git add package.json
|
||||
git commit -m "Update version to ${{ github.ref_name }}"
|
||||
git push origin ${{ github.ref_name }}
|
Loading…
Add table
Add a link
Reference in a new issue