Skip to content

Commit 7ef9004

Browse files
Merge branch 'main' into feat/deploy-command
2 parents 78a2202 + fa36421 commit 7ef9004

3 files changed

Lines changed: 27 additions & 2 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ jobs:
4646
- name: Build
4747
run: |
4848
set -x
49-
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w -extldflags '-static'" -o nodeops main.go
49+
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w -extldflags '-static'" -o createos main.go
5050
ldd createos || true

.github/workflows/release.yaml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ jobs:
6868
GH_TOKEN: ${{ github.token }}
6969
steps:
7070
- uses: actions/checkout@v4
71+
with:
72+
repository: NodeOps-app/homebrew-tap
73+
token: ${{ secrets.TAP_GITHUB_TOKEN }}
7174

7275
- uses: actions/download-artifact@v4
7376
with:
@@ -76,4 +79,22 @@ jobs:
7679

7780
- name: Upload release assets
7881
run: gh release upload "${{ github.ref_name }}" createos-* --clobber
79-
82+
83+
- name: Update homebrew formula
84+
run: |
85+
VERSION="${{ github.ref_name }}"
86+
VERSION_NUM="${VERSION#v}"
87+
88+
ARM64_SHA=$(curl -sL "https://github.com/NodeOps-app/createos-cli/releases/download/${VERSION}/createos-darwin-arm64.sha256")
89+
AMD64_SHA=$(curl -sL "https://github.com/NodeOps-app/createos-cli/releases/download/${VERSION}/createos-darwin-amd64.sha256")
90+
91+
sed -i "s/version \".*\"/version \"${VERSION_NUM}\"/" Formula/createos.rb
92+
sed -i "/on_arm/,/end/{s/sha256 \".*\"/sha256 \"${ARM64_SHA}\"/}" Formula/createos.rb
93+
sed -i "/on_intel/,/end/{s/sha256 \".*\"/sha256 \"${AMD64_SHA}\"/}" Formula/createos.rb
94+
sed -i "s|releases/download/v[^/]*/|releases/download/${VERSION}/|g" Formula/createos.rb
95+
96+
git config user.name "github-actions"
97+
git config user.email "github-actions@github.com"
98+
git add Formula/createos.rb
99+
git commit -m "Update createos to ${VERSION}"
100+
git push

cmd/upgrade/upgrade.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ func fetchLatestRelease() (*githubRelease, error) {
170170
}
171171
defer resp.Body.Close() //nolint:errcheck
172172

173+
// GH sends 403 on rate limit exhaust
174+
if resp.StatusCode == http.StatusForbidden || resp.StatusCode == http.StatusTooManyRequests {
175+
return nil, fmt.Errorf("GitHub API rate limit reached — try again in a few minutes")
176+
}
173177
if resp.StatusCode != http.StatusOK {
174178
return nil, fmt.Errorf("GitHub API returned %d", resp.StatusCode)
175179
}

0 commit comments

Comments
 (0)