@@ -25,25 +25,36 @@ jobs:
2525 - name : Determine Release Mode
2626 id : mode
2727 run : |
28- # 1. Check if we are triggered by a TAG push
28+ # CASE 1: Manual Trigger via Workflow Dispatch
29+ if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
30+ echo "ℹ️ Manual trigger detected. Deploying current state."
31+ echo "do_deploy=true" >> $GITHUB_OUTPUT
32+ echo "do_tag=false" >> $GITHUB_OUTPUT
33+ echo "tag_name=manual-$(date +%s)" >> $GITHUB_OUTPUT
34+ exit 0
35+ fi
36+
37+ # CASE 2: Pushed a Tag (Standard Manual Release)
2938 if [[ "${{ github.ref_type }}" == "tag" ]]; then
30- echo "Triggered by manual tag: ${{ github.ref_name }}"
39+ echo "ℹ️ Triggered by tag: ${{ github.ref_name }}"
3140 echo "do_deploy=true" >> $GITHUB_OUTPUT
3241 echo "do_tag=false" >> $GITHUB_OUTPUT
3342 echo "tag_name=${{ github.ref_name }}" >> $GITHUB_OUTPUT
3443 exit 0
3544 fi
36-
37- # 2. If triggered by BRANCH push, check package.json
45+
46+ # CASE 3: Pushed to Main (Check for Version Bump)
3847 VERSION=$(jq -r .version package.json)
3948 TAG="v$VERSION"
4049
4150 if git rev-parse "$TAG" >/dev/null 2>&1; then
42- echo "Tag $TAG already exists in repo. Assuming manual release triggered separately."
51+ # Tag exists -> Version wasn't bumped -> DO NOT DEPLOY
52+ echo "⚠️ Tag $TAG already exists. Version was not changed. Skipping."
4353 echo "do_deploy=false" >> $GITHUB_OUTPUT
4454 echo "do_tag=false" >> $GITHUB_OUTPUT
4555 else
46- echo "New version $VERSION detected in package.json. Starting auto-release."
56+ # Tag missing -> Version was bumped -> AUTO RELEASE
57+ echo "🚀 New version $VERSION detected. Starting auto-release."
4758 echo "do_deploy=true" >> $GITHUB_OUTPUT
4859 echo "do_tag=true" >> $GITHUB_OUTPUT
4960 echo "tag_name=$TAG" >> $GITHUB_OUTPUT
0 commit comments