From dec9e9e642561686b76d1be381cf5595ef931b28 Mon Sep 17 00:00:00 2001 From: Jehyun Jung Date: Mon, 9 Mar 2026 18:06:54 -0700 Subject: [PATCH] Add tag pipeline --- .github/workflows/auto-tag.yml | 52 ++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/auto-tag.yml diff --git a/.github/workflows/auto-tag.yml b/.github/workflows/auto-tag.yml new file mode 100644 index 0000000..f10a93c --- /dev/null +++ b/.github/workflows/auto-tag.yml @@ -0,0 +1,52 @@ +name: Auto Tag Release + +on: + push: + branches: + - main + paths: + - 'package.json' + workflow_dispatch: + +jobs: + tag: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Get version from package.json + id: version + run: | + VERSION=$(node -p "require('./package.json').version") + echo "VERSION=$VERSION" >> $GITHUB_OUTPUT + echo "TAG=v$VERSION" >> $GITHUB_OUTPUT + + - name: Check if tag already exists + id: tag_check + run: | + TAG="v${{ steps.version.outputs.VERSION }}" + if git rev-parse "$TAG" >/dev/null 2>&1; then + echo "Tag $TAG already exists" + echo "EXISTS=true" >> $GITHUB_OUTPUT + else + echo "Tag $TAG does not exist" + echo "EXISTS=false" >> $GITHUB_OUTPUT + fi + + - name: Create and push tag + if: steps.tag_check.outputs.EXISTS == 'false' + run: | + TAG="${{ steps.version.outputs.TAG }}" + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag "$TAG" + git push origin "$TAG" + echo "✓ Created and pushed tag: $TAG" + + - name: Tag already exists, skipping + if: steps.tag_check.outputs.EXISTS == 'true' + run: | + echo "Tag v${{ steps.version.outputs.VERSION }} already exists. Skipping tag creation."