Skip to content

Commit be8aa7b

Browse files
committed
refactor: update Homebrew tap script to fetch latest release details directly from GitHub API and remove version argument from workflow.
1 parent 1dc6759 commit be8aa7b

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,4 @@ jobs:
136136
env:
137137
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
138138
run: |
139-
bash scripts/update-homebrew-tap.sh "${GITHUB_REF_NAME#v}"
139+
bash scripts/update-homebrew-tap.sh

scripts/update-homebrew-tap.sh

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,22 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
VERSION="$1"
5-
6-
if [ -z "$VERSION" ]; then
7-
echo "VERSION argument is required"
8-
exit 1
9-
fi
10-
114
if [ -z "${GITHUB_TOKEN:-}" ]; then
125
echo "GITHUB_TOKEN is not set"
136
exit 1
147
fi
15-
TAG="v${VERSION}"
16-
curl -f -L "https://api.github.com/repos/milisp/codexia/releases/tags/${TAG}" > release.json
8+
curl -f -L \
9+
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
10+
-H "Accept: application/vnd.github+json" \
11+
"https://api.github.com/repos/milisp/codexia/releases/latest" > release.json
1712
RELEASE_JSON="release.json"
1813

1914
if [ ! -f "$RELEASE_JSON" ]; then
2015
echo "Error: $RELEASE_JSON not found. Please ensure it exists."
2116
exit 1
2217
fi
2318

24-
RELEASE_TAG=$(jq -r '.tag_name' "$RELEASE_JSON")
25-
if [ "$RELEASE_TAG" != "$TAG" ]; then
26-
echo "Error: fetched release tag ($RELEASE_TAG) does not match expected tag ($TAG)"
27-
exit 1
28-
fi
19+
VERSION=$(jq -r '.tag_name' "$RELEASE_JSON")
2920

3021
git clone https://x-access-token:${GITHUB_TOKEN}@github.com/milisp/homebrew-codexia.git
3122
cd homebrew-codexia

0 commit comments

Comments
 (0)