Workflow file for this run
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: Node.js Update package.json version | |
on: | |
release: | |
types: [created] | |
jobs: | |
update-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
# Extract tag version from release event payload | |
- name: Extract tag version | |
id: extract-tag | |
run: echo "tag_version=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
# Update package.json version | |
- name: Update package version | |
run: | | |
TAG_VERSION=${{ env.tag_version }} | |
jq ".version = \"$TAG_VERSION\"" package.json > temp.json | |
mv temp.json package.json | |
# Commit and push changes | |
- name: Commit and push version bump | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions" | |
git commit -am "Bump version to $TAG_VERSION [skip ci]" | |
git push origin HEAD:${{ github.ref_name }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |