Skip to content

Update auto-tag.yaml #10

Update auto-tag.yaml

Update auto-tag.yaml #10

Workflow file for this run

name: Auto Tag Version
on:
push:
branches:
- master
workflow_dispatch: # allows manual trigger
jobs:
tag_version:
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v3
- name: get package.json version
id: get_version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: check if tag exists
id: check_tag
run: |
if git rev-parse "refs/tags/${{ env.VERSION }}" >/dev/null 2>&1; then
echo "Tag already exists"
exit 0
fi
- name: create new tag
if: steps.check_tag.outputs.tag_exists != 'true'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git tag ${{ env.VERSION }} -m "tag for version ${{ env.VERSION }}"
git push origin ${{ env.VERSION }}