@@ -45,11 +45,15 @@ jobs:
4545
4646 - name : 🏷️ Resolve version
4747 id : version
48+ env :
49+ EVENT_NAME : ${{ github.event_name }}
50+ INPUT_TAG : ${{ inputs.tag }}
51+ REF_NAME : ${{ github.ref_name }}
4852 run : |
49- if [ "${{ github.event_name }} " = "workflow_dispatch" ]; then
50- CLEAN="${{ inputs.tag }} " # full tag as provided (e.g. 1.1.3 or v2.0.0)
53+ if [ "$EVENT_NAME " = "workflow_dispatch" ]; then
54+ CLEAN="$INPUT_TAG " # full tag as provided (e.g. 1.1.3 or v2.0.0)
5155 else
52- CLEAN="${{ github.ref_name }}" # e.g. v2.0.0
56+ CLEAN="$REF_NAME" # e.g. v2.0.0
5357 fi
5458 CLEAN="${CLEAN#v}" # strip leading v if present → 2.0.0 or 1.1.3
5559 echo "clean=$CLEAN" >> "$GITHUB_OUTPUT"
7175 push : true
7276 tag_push : ${{ github.ref_type == 'tag' }}
7377 version : ${{ needs.resolve-version.outputs.version }}
74- secrets : inherit
78+ secrets :
79+ DOCKERHUB_USERNAME : ${{ secrets.DOCKERHUB_USERNAME }}
80+ DOCKERHUB_TOKEN : ${{ secrets.DOCKERHUB_TOKEN }}
7581
7682 # ── Job 3: Create GitHub release + update CHANGELOG ────────────────────────
7783 # Runs once after the image is successfully pushed (not for workflow_dispatch
@@ -102,30 +108,35 @@ jobs:
102108 repositories : socket-basics
103109
104110 - name : 📝 Create GitHub release with auto-generated notes
111+ env :
112+ GH_TOKEN : ${{ steps.bot.outputs.token }}
113+ REF_NAME : ${{ github.ref_name }}
105114 run : |
106- gh release create "${{ github.ref_name }} " \
107- --title "${{ github.ref_name }} " \
115+ gh release create "$REF_NAME " \
116+ --title "$REF_NAME " \
108117 --generate-notes \
109118 --verify-tag \
110119 || echo "Release already exists (re-run scenario) — skipping creation"
111- env :
112- GH_TOKEN : ${{ steps.bot.outputs.token }}
113120
114121 - name : 📋 Update CHANGELOG.md
122+ env :
123+ GH_TOKEN : ${{ steps.bot.outputs.token }}
124+ REF_NAME : ${{ github.ref_name }}
115125 run : |
116- NOTES=$(gh release view "${{ github.ref_name }} " --json body --jq .body)
126+ NOTES=$(gh release view "$REF_NAME " --json body --jq .body)
117127 DATE=$(date +%Y-%m-%d)
118128 echo "$NOTES" | python scripts/update_changelog.py \
119129 --version "$VERSION" \
120130 --date "$DATE"
121- env :
122- GH_TOKEN : ${{ steps.bot.outputs.token }}
123131
124132 - name : 🔀 Commit CHANGELOG + action.yml back to main
133+ env :
134+ BOT_TOKEN : ${{ steps.bot.outputs.token }}
135+ REF_NAME : ${{ github.ref_name }}
125136 run : |
126137 git config user.name "socket-release-bot[bot]"
127138 git config user.email "socket-release-bot[bot]@users.noreply.github.com"
128- git remote set-url origin "https://x-access-token:${{ steps.bot.outputs.token } }@github.com/SocketDev/socket-basics.git"
139+ git remote set-url origin "https://x-access-token:${BOT_TOKEN }@github.com/SocketDev/socket-basics.git"
129140
130141 # Auto-update action.yml image ref to the new version.
131142 # No-op if action.yml still uses `image: "Dockerfile"` (handles the
@@ -138,5 +149,5 @@ jobs:
138149 fi
139150
140151 git add CHANGELOG.md action.yml
141- git diff --cached --quiet || git commit -m "chore: release ${{ github.ref_name } } — update CHANGELOG and action.yml [skip ci]"
152+ git diff --cached --quiet || git commit -m "chore: release ${REF_NAME } — update CHANGELOG and action.yml [skip ci]"
142153 git push origin HEAD:main
0 commit comments