88jobs :
99 # Run semantic-release to create version, changelog, and tag
1010 semantic-release :
11- # Skip if commit message starts with 'chore( release):'
11+ # Only run if NOT a release commit
1212 if : ${{ !startsWith(github.event.head_commit.message, 'chore(release):') }}
1313 runs-on : ubuntu-latest
1414 outputs :
8181
8282 # Build binaries for multiple platforms
8383 build :
84- needs : semantic- release
85- if : needs.semantic-release.outputs.new_release_published == 'true'
84+ # Run only for release commits (when we have the new version)
85+ if : ${{ startsWith(github.event.head_commit.message, 'chore(release):') }}
8686 runs-on : ${{ matrix.os }}
8787 strategy :
8888 matrix :
@@ -103,12 +103,6 @@ jobs:
103103 steps :
104104 - name : Checkout code
105105 uses : actions/checkout@v4
106- with :
107- ref : main
108- fetch-depth : 0
109-
110- - name : Pull latest changes
111- run : git pull origin main
112106
113107 - name : Setup Node.js
114108 uses : actions/setup-node@v4
@@ -154,8 +148,8 @@ jobs:
154148
155149 # Upload binaries to the GitHub release
156150 upload-binaries :
157- needs : [semantic-release, build]
158- if : needs.semantic-release.outputs.new_release_published == 'true'
151+ needs : build
152+ if : ${{ startsWith(github.event.head_commit.message, 'chore(release):') }}
159153 runs-on : ubuntu-latest
160154 permissions :
161155 contents : write
@@ -176,10 +170,17 @@ jobs:
176170 ls -la ./binaries/
177171 find ./binaries -type f -exec ls -la {} \;
178172
173+ - name : Get version from package.json
174+ id : get_version
175+ run : |
176+ VERSION=$(node -p "require('./package.json').version")
177+ echo "version=${VERSION}" >> $GITHUB_OUTPUT
178+ echo "Version: ${VERSION}"
179+
179180 - name : Upload binaries to release
180181 env :
181182 GITHUB_TOKEN : ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
182- VERSION : ${{ needs.semantic-release .outputs.new_release_version }}
183+ VERSION : ${{ steps.get_version .outputs.version }}
183184 run : |
184185 # Get the release ID for the version tag
185186 RELEASE_ID=$(gh api repos/${{ github.repository }}/releases/tags/v${VERSION} --jq '.id' || echo "")
@@ -202,8 +203,8 @@ jobs:
202203
203204 # Publish to other registries and update Homebrew
204205 publish-extras :
205- needs : semantic-release
206- if : needs.semantic-release.outputs.new_release_published == 'true'
206+ needs : upload-binaries
207+ if : ${{ startsWith(github.event.head_commit.message, 'chore(release):') }}
207208 runs-on : ubuntu-latest
208209 steps :
209210 - name : Checkout code
@@ -216,10 +217,17 @@ jobs:
216217 with :
217218 node-version : ' 20'
218219
220+ - name : Get version from package.json
221+ id : get_version
222+ run : |
223+ VERSION=$(node -p "require('./package.json').version")
224+ echo "version=${VERSION}" >> $GITHUB_OUTPUT
225+ echo "Version: ${VERSION}"
226+
219227 - name : Publish to GitHub Packages
220228 env :
221229 NODE_AUTH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
222- VERSION : ${{ needs.semantic-release .outputs.new_release_version }}
230+ VERSION : ${{ steps.get_version .outputs.version }}
223231 run : |
224232 echo "Publishing version ${VERSION} to GitHub Packages..."
225233
@@ -248,7 +256,7 @@ jobs:
248256 - name : Update Homebrew Tap
249257 env :
250258 GITHUB_TOKEN : ${{ secrets.GH_TOKEN }}
251- VERSION : ${{ needs.semantic-release .outputs.new_release_version }}
259+ VERSION : ${{ steps.get_version .outputs.version }}
252260 run : |
253261 # Check if GH_TOKEN is available
254262 if [ -z "$GITHUB_TOKEN" ]; then
0 commit comments