From 1235039da514b4b5f1444f40de20987205c80e64 Mon Sep 17 00:00:00 2001 From: literat Date: Thu, 3 Oct 2024 18:54:20 +0200 Subject: [PATCH] fixup! Chore(ci): Check if branch has tag for publishing --- .github/workflows/publish.yaml | 35 ++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index fd9d15e85d..c1cee9a33f 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -10,45 +10,48 @@ on: - release/beta jobs: - publish: - name: Publish package + hasTag: + name: 🏷️ Analyze Tags runs-on: ubuntu-24.04 + + outputs: + hasTag: ${{ steps.checkTagExists.outputs.has-tag }} + steps: - name: Clone repository uses: actions/checkout@v4 - - name: Fetch tags - run: git fetch --tags - - - name: Tag - run: echo "tag - ${{ github.ref }}" - - - name: Check if commit has a tag - id: check_tag + - name: Check Tag On Commit + id: checkTagExists run: | if [ -n "$(git tag --points-at HEAD)" ]; then - echo "has_tag=true" >> $GITHUB_ENV + echo "has-tag=true" >> "$GITHUB_OUTPUT" else - echo "has_tag=false" >> $GITHUB_ENV + echo "has-tag=false" >> "$GITHUB_OUTPUT" fi + publish: + name: 🚀 📦 Publish Package + runs-on: ubuntu-24.04 + needs: [hasTag] + if: ${{ needs.hasTag.outputs.has-tag == 'true' }} + steps: + - name: Clone repository + uses: actions/checkout@v4 + - name: Enable Corepack - if: env.has_tag == 'true' run: corepack enable - name: Configure Node.js - if: env.has_tag == 'true' uses: actions/setup-node@v4 with: node-version-file: '.nvmrc' cache: 'yarn' - name: Install dependencies - if: env.has_tag == 'true' run: yarn --immutable --inline-builds - name: Build - if: env.has_tag == 'true' run: yarn build # - name: Authenticate npm