Prepare for release 1.3.10 (#320) #12
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
# create a git tag when the package.json version is updated | |
name: tag | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'package.json' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
concurrency: | |
group: ${{ github.workflow }} | |
jobs: | |
tag: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Get package version | |
id: get_version | |
run: | | |
VERSION=$(node -p "require('./package.json').version") | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Check if git tag exists | |
id: check_tag | |
run: | | |
git fetch --tags | |
VERSION=$(echo $VERSION) | |
if [[ $(git tag -l v$VERSION | wc -l) -eq '1' ]]; then | |
echo "git tag already exists" | |
echo "TAG=false" >> $GITHUB_ENV | |
else | |
echo "git tag does not exist" | |
echo "TAG=true" >> $GITHUB_ENV | |
fi | |
- name: Create git tag | |
if: env.TAG == 'true' | |
run: git tag v${{ env.VERSION }} | |
- name: Push git tag | |
if: env.TAG == 'true' | |
run: git push --tags |