Skip to content

Commit

Permalink
Chore(ci): Publish only when git tag exists
Browse files Browse the repository at this point in the history
refs #DS-1434
  • Loading branch information
literat committed Oct 4, 2024
1 parent 088b7e6 commit c8eafa2
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,36 @@ on:
- release/beta

jobs:
hasTag:
name: 🏷️ Analyze Tags
runs-on: ubuntu-24.04

outputs:
hasTag: ${{ steps.checkTagExists.outputs.has-tag }}

steps:
- name: Clone repository
uses: actions/checkout@v4
with:
fetch-tags: true

# ⚠️ This check works only if the tag is pushed alongside the commit
# Please, use `git push && git push --tags` or `git push --follow-tags` (works only for annonated tags)
- name: Check Tag On Commit
id: checkTagExists
run: |
if [ -n "$(git tag --points-at HEAD)" ]; then
echo "has-tag=true" >> $GITHUB_OUTPUT
else
echo "has-tag=false" >> $GITHUB_OUTPUT
fi
publish:
if: ${{ startsWith(github.ref, 'refs/tags/') }}
name: Publish package
name: 🚀 📦 Publish Packages
needs: hasTag
if: ${{ needs.hasTag.outputs.hasTag == 'true' }}
runs-on: ubuntu-24.04

steps:
- name: Clone repository
uses: actions/checkout@v4
Expand Down

0 comments on commit c8eafa2

Please sign in to comment.