Skip to content

Commit ff059c8

Browse files
Codestzxclaude
andcommitted
fix(release): fix secret name and homebrew first-run creation
- CRATES_IO_TOKEN → CARGO_REGISTRY_TOKEN - Homebrew step now handles both create (first release) and update Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 3930976 commit ff059c8

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

.github/workflows/release.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
uses: dtolnay/rust-toolchain@stable
8989

9090
- name: Publish
91-
run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }}
91+
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
9292

9393
# ── Update Homebrew tap automatically ─────────────────────────────────────
9494
homebrew:
@@ -174,20 +174,22 @@ jobs:
174174
set -e
175175
CONTENT=$(base64 -w 0 /tmp/krait.rb)
176176
177-
RESPONSE=$(curl -sf \
177+
# Get existing file SHA if it exists (empty on first release)
178+
FILE_SHA=$(curl -s \
178179
-H "Authorization: token $TAP_TOKEN" \
179-
"https://api.github.com/repos/Codestz/homebrew-krait/contents/Formula/krait.rb")
180-
FILE_SHA=$(echo "$RESPONSE" | jq -r '.sha')
180+
"https://api.github.com/repos/Codestz/homebrew-krait/contents/Formula/krait.rb" \
181+
| jq -r '.sha // empty')
181182
182-
if [ "$FILE_SHA" = "null" ] || [ -z "$FILE_SHA" ]; then
183-
echo "::error::Failed to get file SHA from tap repo. Check HOMEBREW_TAP_TOKEN."
184-
exit 1
183+
if [ -n "$FILE_SHA" ]; then
184+
PAYLOAD="{\"message\":\"chore: bump to v${VERSION}\",\"content\":\"${CONTENT}\",\"sha\":\"${FILE_SHA}\"}"
185+
else
186+
PAYLOAD="{\"message\":\"chore: add formula for v${VERSION}\",\"content\":\"${CONTENT}\"}"
185187
fi
186188
187189
curl -sf -X PUT \
188190
-H "Authorization: token $TAP_TOKEN" \
189191
-H "Content-Type: application/json" \
190192
"https://api.github.com/repos/Codestz/homebrew-krait/contents/Formula/krait.rb" \
191-
-d "{\"message\":\"chore: bump to v${VERSION}\",\"content\":\"${CONTENT}\",\"sha\":\"${FILE_SHA}\"}"
193+
-d "$PAYLOAD"
192194
193195
echo "Homebrew tap updated to v${VERSION}"

0 commit comments

Comments
 (0)