Skip to content

Commit 5f8ee0f

Browse files
authored
ci(release): push the Homebrew formula with a homebrew-tap deploy key (#59516)
1 parent 362e000 commit 5f8ee0f

4 files changed

Lines changed: 15 additions & 24 deletions

File tree

‎.github/release/lib.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ push_git() {
103103
if dry_run; then return; fi
104104
git -C "$dir" add -A
105105
if git -C "$dir" diff --cached --quiet; then return; fi
106-
git -C "$dir" -c user.name="opencode-agent[bot]" -c user.email="opencode-agent[bot]@users.noreply.github.com" \
106+
git -C "$dir" -c user.name="github-actions[bot]" -c user.email="41898282+github-actions[bot]@users.noreply.github.com" \
107107
commit -q -m "$message"
108108
git -C "$dir" push -q origin HEAD:master
109109
}
Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
#!/usr/bin/env bash
2-
# publish-homebrew.sh <sign-macos dir> <build-archives dir>: updates opencode-v2 in anomalyco/homebrew-tap
3-
# (HOMEBREW_TOKEN) and registers the homebrew update artifact.
2+
# publish-homebrew.sh <sign-macos dir> <build-archives dir>: updates opencode-v2 in anomalyco/homebrew-tap over SSH
3+
# with its write deploy key (HOMEBREW_TAP_DEPLOY_KEY) and registers the homebrew update artifact.
44
. "$(dirname "$0")/lib.sh"
55

6-
push_git "https://x-access-token:${HOMEBREW_TOKEN:-}@github.com/anomalyco/homebrew-tap.git" \
6+
if ! dry_run; then
7+
test -n "${HOMEBREW_TAP_DEPLOY_KEY:-}" || die "Missing HOMEBREW_TAP_DEPLOY_KEY"
8+
ssh_dir=$(mktemp -d)
9+
printf '%s\n' "$HOMEBREW_TAP_DEPLOY_KEY" > "$ssh_dir/key"
10+
chmod 600 "$ssh_dir/key"
11+
echo "github.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl" > "$ssh_dir/known_hosts"
12+
export GIT_SSH_COMMAND="ssh -i $ssh_dir/key -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes -o UserKnownHostsFile=$ssh_dir/known_hosts"
13+
fi
14+
15+
push_git "[email protected]:anomalyco/homebrew-tap.git" \
716
"chore: update opencode-v2 to $OPENCODE_VERSION" bash "$release_dir/render-homebrew.sh" "$1" "$2"
817
publish_update cli homebrew '{"package": "anomalyco/tap/opencode-v2"}'

‎.github/workflows/release-dry-run.yml‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -631,19 +631,10 @@ jobs:
631631
steps:
632632
- *checkout-release
633633
- *download-signed-cli
634-
- id: token
635-
name: Create token
636-
if: needs.plan.outputs.dry_run != 'true'
637-
uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2.2.2
638-
with:
639-
app-id: ${{ vars.OPENCODE_APP_ID }}
640-
private-key: ${{ secrets.OPENCODE_APP_SECRET }}
641-
owner: anomalyco
642-
repositories: homebrew-tap
643634
- name: Publish
644635
run: bash .github/release/publish-homebrew.sh "$RUNNER_TEMP/in/sign-macos" "$RUNNER_TEMP/in/build-archives"
645636
env:
646-
HOMEBREW_TOKEN: ${{ steps.token.outputs.token }}
637+
HOMEBREW_TAP_DEPLOY_KEY: ${{ secrets.HOMEBREW_TAP_DEPLOY_KEY }}
647638

648639
# The AUR package installs the published npm tarballs, so it follows the npm publish.
649640
publish-aur:

‎.github/workflows/release.yml‎

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -650,19 +650,10 @@ jobs:
650650
steps:
651651
- *checkout-release
652652
- *download-signed-cli
653-
- id: token
654-
name: Create token
655-
if: needs.plan.outputs.dry_run != 'true'
656-
uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2.2.2
657-
with:
658-
app-id: ${{ vars.OPENCODE_APP_ID }}
659-
private-key: ${{ secrets.OPENCODE_APP_SECRET }}
660-
owner: anomalyco
661-
repositories: homebrew-tap
662653
- name: Publish
663654
run: bash .github/release/publish-homebrew.sh "$RUNNER_TEMP/in/sign-macos" "$RUNNER_TEMP/in/build-archives"
664655
env:
665-
HOMEBREW_TOKEN: ${{ steps.token.outputs.token }}
656+
HOMEBREW_TAP_DEPLOY_KEY: ${{ secrets.HOMEBREW_TAP_DEPLOY_KEY }}
666657

667658
# The AUR package installs the published npm tarballs, so it follows the npm publish.
668659
publish-aur:

0 commit comments

Comments
 (0)