Skip to content

version update on develop #6

version update on develop

version update on develop #6

name: Update Package.json Version
on:
pull_request:
types: [opened, synchronize, reopened, closed]
branches: [develop, main, stage]
permissions: write-all
jobs:
update_version_and_tag:
# if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Get and update git release tag
id: git-tag
run: echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT
# run: echo ::set-output name=tag::$(git describe --tags --abbrev=0 || 'latest')
- name: Print the tag
run: echo ${{ steps.git-tag.outputs.tag }}
- name: Update package.json version
id: update_pkg_version
run: |
npm version "${{ steps.git-tag.outputs.tag }}" --no-git-tag-version
echo "::set-output name=new_version::$(node -p -e "require('./package.json').version")"
- name: Commit and push changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -am "Update package.json version to ${{ steps.update_pkg_version.outputs.new_version }}"
git push