GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ci: separate release builds from signing and publishing (#59046) · abn/opencode@6996bbc

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .github
    • CODEOWNERS
    • publish-python-sdk.yml
    • release
      • download
        • action.yml
      • entitlements
        • cli.plist
        • desktop-cli.plist
        • desktop.plist
      • lib.sh
      • plan-release.sh
      • publish-aur.sh
      • publish-cli.sh
      • publish-desktop.sh
      • publish-docker.sh
      • publish-github-release.sh
      • publish-homebrew.sh
      • publish-npm.sh
      • publish-version-pr.sh
      • render-aur.sh
      • render-homebrew.sh
      • render-winget.sh
      • repack-windows.sh
      • sign-cli-macos.sh
      • sign-desktop-macos.sh
      • tag-release.sh
      • unpack-windows.sh
      • upload
        • action.yml
      • verify-artifacts.sh
      • verify-signatures-windows.sh
      • write-checksums.sh
    • workflows
      • bot-docs-locale.yml
      • bot-nix-hashes.yml
      • check-test.yml
      • deploy-changelog.yml
      • deploy-files.yml
      • deploy-www.yml
      • deploy.yml
      • notify-discord.yml
      • publish-vscode.yml
      • publish.yml
      • release-dry-run.yml
      • release.yml
  • .opencode/skills/unit-tests
    • SKILL.md
  • README.ar.md
  • README.bn.md
  • README.br.md
  • README.bs.md
  • README.da.md
  • README.de.md
  • README.es.md
  • README.fr.md
  • README.gr.md
  • README.it.md
  • README.ja.md
  • README.ko.md
  • README.md
  • README.no.md
  • README.pl.md
  • README.ru.md
  • README.th.md
  • README.tr.md
  • README.uk.md
  • README.vi.md
  • README.zh.md
  • README.zht.md
  • bun.lock
  • nix
    • desktop.nix
  • package.json
  • packages
    • ai
      • package.json
      • script
        • pack.ts
        • publish.ts
    • app
      • README.md
      • e2e/performance
        • devex
          • desktop-startup.ts
        • unit
          • desktop-startup.test.ts
    • client
      • package.json
      • script
        • build-package.ts
        • build.ts
        • generate.ts
        • pack.ts
        • publish.ts
    • cli
      • package.json
      • script
        • build-node.ts
        • build.ts
        • catalog-smoke.ts
        • pack.ts
        • publish-aur.ts
        • publish-homebrew.ts
    • codemode
      • package.json
      • script
        • pack.ts
        • publish.ts
    • core
      • package.json
      • script
        • pack.ts
        • publish.ts
    • desktop
      • README.md
      • electron-builder.config.test.ts
      • electron-builder.config.ts
      • electron.vite.config.test.ts
      • electron.vite.config.ts
      • package.json
      • scripts
        • copy-bundles.ts
        • prebuild.ts
        • prepare.ts
        • publish.ts
        • upload.ts
      • script
        • bench-startup.ts
        • bench-variant.ps1
        • beta-notes.test.ts
        • beta-notes.ts
        • beta-visual.ts
        • build.ts
        • copy-icons.ts
        • copy-metainfo.ts
        • dev-electron.ts
        • dev.ts
        • fixtures/picker
          • index.html
          • main.ts
        • migration.ts
        • pack.ts
        • picker.test.ts
        • picker.ts
        • profile-by-source.ts
        • utils.ts
        • windows-installer.test.ts
      • src/main/storage
        • migration.gen.ts
    • gui-extensions/src
      • env.d.ts
      • updater
        • beta-notes.ts
      • wsl
        • local.ts
    • plugin-browser
      • package.json
      • script
        • pack.ts
        • publish.ts
    • plugin
      • package.json
      • script
        • pack.ts
        • publish.ts
    • protocol
      • package.json
      • script
        • pack.ts
        • publish.ts
    • schema
      • package.json
      • script
        • pack.ts
        • publish.ts
    • script
      • package.json
      • src
        • index.ts
        • pack.ts
    • sdk
      • package.json
      • script
        • pack.ts
        • publish.ts
    • server
      • package.json
      • script
        • pack.ts
        • publish.ts
    • simulation
      • package.json
      • script
        • pack.ts
        • publish.ts
    • theme
      • package.json
      • script
        • pack.ts
        • publish.ts
    • ui
      • package.json
      • script
        • pack.ts
        • publish.ts
    • util
      • package.json
      • script
        • pack.ts
        • publish.ts
  • script
    • lint-changed.ts
    • pack.ts
    • publish-winget.ts
    • publish.ts
    • release.ts
    • sign-windows.ps1
    • update-artifact.ts
    • version.ts
    • wait-for-artifact.ts
  • services
    • README.md
    • files
      • README.md
    • update
      • README.md
      • src
        • index.ts
      • test
        • index.test.ts

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/CODEOWNERS‎

Copy file name to clipboard
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
# web + desktop packages
22
packages/app/ @Hona @Brendonovich
33
packages/desktop/ @Hona @Brendonovich
4+
5+
# CI and releases. Release jobs that hold secrets run only .github/workflows/release.yml and .github/release/,
6+
# which makes this path the release security boundary.
7+
/.github/ @anomalyco/ci-owners
Collapse file

‎.github/publish-python-sdk.yml‎

Copy file name to clipboardExpand all lines: .github/publish-python-sdk.yml
-71Lines changed: 0 additions & 71 deletions
This file was deleted.
Collapse file

‎.github/release/download/action.yml‎

Copy file name to clipboard
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Download release artifacts
2+
description: Downloads artifacts into $RUNNER_TEMP/in/<name> and verifies each against its SHA256SUMS.
3+
inputs:
4+
pattern:
5+
description: Artifact name pattern
6+
required: true
7+
digests:
8+
description: Space-separated name=digest pairs for artifacts made by sign jobs, from their job outputs
9+
required: false
10+
default: ""
11+
runs:
12+
using: composite
13+
steps:
14+
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
15+
with:
16+
pattern: ${{ inputs.pattern }}
17+
path: ${{ runner.temp }}/in
18+
- shell: bash
19+
run: bash "${GITHUB_ACTION_PATH//\\//}/../verify-artifacts.sh" "$RUNNER_TEMP/in"
20+
env:
21+
OPENCODE_DIGESTS: ${{ inputs.digests }}
Collapse file

‎packages/cli/script/entitlements.plist‎ ‎.github/release/entitlements/cli.plist‎packages/cli/script/entitlements.plist renamed to .github/release/entitlements/cli.plist

Copy file name to clipboard
File renamed without changes.
Collapse file

‎…desktop/resources/entitlements.cli.plist‎ ‎…b/release/entitlements/desktop-cli.plist‎packages/desktop/resources/entitlements.cli.plist renamed to .github/release/entitlements/desktop-cli.plist packages/desktop/resources/entitlements.cli.plist renamed to .github/release/entitlements/desktop-cli.plist

Copy file name to clipboard
File renamed without changes.
Collapse file

‎…ges/desktop/resources/entitlements.plist‎ ‎…ithub/release/entitlements/desktop.plist‎packages/desktop/resources/entitlements.plist renamed to .github/release/entitlements/desktop.plist packages/desktop/resources/entitlements.plist renamed to .github/release/entitlements/desktop.plist

Copy file name to clipboard
File renamed without changes.
Collapse file

‎.github/release/lib.sh‎

Copy file name to clipboard
+109Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# Shared helpers for the release scripts. Sourced, never executed.
2+
#
3+
# These scripts run in sign and publish jobs that hold secrets. They must never execute repository code
4+
# or artifact contents: artifacts are data, and every value that names a destination comes from the
5+
# environment the workflow sets (OPENCODE_VERSION, OPENCODE_CHANNEL, OPENCODE_DRY_RUN, ...).
6+
7+
set -euo pipefail
8+
9+
# shellcheck disable=SC2034 # used by the scripts that source this file
10+
release_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
11+
12+
die() {
13+
echo "::error::$*" >&2
14+
exit 1
15+
}
16+
17+
dry_run() {
18+
[ "${OPENCODE_DRY_RUN:-false}" = true ]
19+
}
20+
21+
sha256() {
22+
if command -v sha256sum > /dev/null; then sha256sum "$@"; else shasum -a 256 "$@"; fi
23+
}
24+
25+
# Windows runners pass D:\a\_temp style paths; Git Bash tools want /d/a/_temp.
26+
posix() {
27+
if command -v cygpath > /dev/null; then cygpath -u "$1"; else printf '%s' "$1"; fi
28+
}
29+
30+
size() {
31+
wc -c < "$1" | tr -d ' '
32+
}
33+
34+
# Uploads files to opencode.ai/files/bin/<version>/ and prints the update-server file map.
35+
upload_files() {
36+
local credentials=false
37+
for file in "$@"; do
38+
test -s "$file" || die "Missing release file: $file"
39+
local name type
40+
name=$(basename "$file")
41+
case "$name" in
42+
*.tar.gz) type=application/gzip ;;
43+
*.zip) type=application/zip ;;
44+
*) type=application/octet-stream ;;
45+
esac
46+
if dry_run; then
47+
echo "dry-run upload: bin/$OPENCODE_VERSION/$name" >&2
48+
else
49+
if [ "$credentials" = false ]; then
50+
r2_credentials
51+
credentials=true
52+
fi
53+
aws s3 cp "$file" "s3://opencode-production-files/bin/$OPENCODE_VERSION/$name" --only-show-errors \
54+
--endpoint-url "https://$CLOUDFLARE_ACCOUNT_ID.r2.cloudflarestorage.com" \
55+
--content-type "$type" --content-disposition "attachment; filename=\"$name\"" \
56+
--cache-control "public, max-age=31536000, immutable" >&2
57+
fi
58+
jq -n --arg name "$name" --arg url "https://opencode.ai/files/bin/$OPENCODE_VERSION/$name" \
59+
--arg sha256 "$(sha256 "$file" | cut -c1-64)" --argjson size "$(size "$file")" \
60+
'{($name): {url: $url, sha256: $sha256, size: $size}}'
61+
done | jq -s 'add'
62+
}
63+
64+
# R2 accepts the API token ID as the access key and SHA-256(token) as the secret.
65+
r2_credentials() {
66+
local id
67+
id=$(curl -fsS -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
68+
"https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/tokens/verify" | jq -er .result.id)
69+
export AWS_ACCESS_KEY_ID="$id"
70+
AWS_SECRET_ACCESS_KEY=$(printf '%s' "$CLOUDFLARE_API_TOKEN" | sha256 | cut -c1-64)
71+
export AWS_SECRET_ACCESS_KEY
72+
export AWS_DEFAULT_REGION=auto AWS_REQUEST_CHECKSUM_CALCULATION=when_required AWS_RESPONSE_CHECKSUM_VALIDATION=when_required
73+
}
74+
75+
# Registers one artifact with the update server: publish_update <name> <distribution> <metadata json>.
76+
publish_update() {
77+
local body status token attempt
78+
body=$(jq -n --arg channel "$OPENCODE_CHANNEL" --arg version "$OPENCODE_VERSION" --arg name "$1" --arg distribution "$2" \
79+
--argjson metadata "$3" '{channel: $channel, name: $name, distribution: $distribution, version: $version, metadata: $metadata}')
80+
echo "$body" | jq .
81+
if dry_run; then return; fi
82+
token=$(curl -fsS -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
83+
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=https://update.opencode.ai" | jq -er .value)
84+
for attempt in 1 2 3; do
85+
status=$(curl -sS -o "$RUNNER_TEMP/update-response" -w '%{http_code}' -X POST https://opencode.ai/update/api/publish \
86+
-H "Authorization: Bearer $token" -H "Content-Type: application/json" --data "$body")
87+
if [ "$status" -lt 300 ]; then return; fi
88+
cat "$RUNNER_TEMP/update-response"
89+
# D1 can commit the upsert and still time out. Replaying the same artifact is safe.
90+
if [ "$status" -lt 500 ] || [ "$attempt" = 3 ]; then die "Update server returned $status"; fi
91+
sleep "$attempt"
92+
done
93+
}
94+
95+
# Clones a repository, lets a render script fill it, then commits and pushes any change:
96+
# push_git <clone url> <commit message> <render script> [args...]. Dry runs render into an empty directory.
97+
push_git() {
98+
local url=$1 message=$2 dir
99+
shift 2
100+
dir=$(mktemp -d)
101+
if ! dry_run; then git clone -q "$url" "$dir"; fi
102+
"$@" "$dir"
103+
if dry_run; then return; fi
104+
git -C "$dir" add -A
105+
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" \
107+
commit -q -m "$message"
108+
git -C "$dir" push -q origin HEAD:master
109+
}
Collapse file

‎.github/release/plan-release.sh‎

Copy file name to clipboard
+65Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/usr/bin/env bash
2+
# plan-release.sh: decides version, channel and npm dist-tag from the event, ref and dispatch inputs
3+
# (INPUT_BUMP, INPUT_VERSION) only, and writes them to $GITHUB_OUTPUT. Nothing here reads repository files.
4+
#
5+
# push or dispatch on dev -> dev 0.0.0-dev-<run> npm tag dev
6+
# dispatch on dev with bump/version -> latest x.y.z npm tag latest
7+
# push or dispatch on beta -> beta 0.0.0-beta-<run> desktop only
8+
# pull_request -> pr 0.0.0-pr-<run> everything, dry run
9+
. "$(dirname "$0")/lib.sh"
10+
11+
versioned=false
12+
if [ -n "${INPUT_BUMP:-}" ] || [ -n "${INPUT_VERSION:-}" ]; then versioned=true; fi
13+
case "$GITHUB_EVENT_NAME:$GITHUB_REF:$versioned" in
14+
push:refs/heads/dev:false | workflow_dispatch:refs/heads/dev:false) channel="dev" ;;
15+
workflow_dispatch:refs/heads/dev:true) channel="latest" ;;
16+
push:refs/heads/beta:false | workflow_dispatch:refs/heads/beta:false) channel="beta" ;;
17+
pull_request:*:false) channel="pr" ;;
18+
*) die "$GITHUB_EVENT_NAME on $GITHUB_REF cannot publish (versioned: $versioned)" ;;
19+
esac
20+
21+
if [ "$channel" = latest ] && [ -n "${INPUT_VERSION:-}" ]; then
22+
version=$INPUT_VERSION
23+
elif [ "$channel" = latest ]; then
24+
current=$(curl -fsS https://registry.npmjs.org/-/package/@opencode%2fcli/dist-tags | jq -r .latest)
25+
[[ "$current" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]] || die "Unexpected latest version: $current"
26+
major=${BASH_REMATCH[1]} minor=${BASH_REMATCH[2]} patch=${BASH_REMATCH[3]}
27+
case "$INPUT_BUMP" in
28+
major) version="$((major + 1)).0.0" ;;
29+
minor) version="$major.$((minor + 1)).0" ;;
30+
*) version="$major.$minor.$((patch + 1))" ;;
31+
esac
32+
if [ "$major" -lt 2 ]; then version=2.0.0; fi
33+
else
34+
version="0.0.0-$channel-$GITHUB_RUN_NUMBER"
35+
if [ "$GITHUB_RUN_ATTEMPT" != 1 ]; then version="$version.$GITHUB_RUN_ATTEMPT"; fi
36+
fi
37+
38+
if [ "$channel" = latest ]; then
39+
if ! [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]] || [[ "$version" == 0.0.0-* ]]; then
40+
die "Invalid release version: $version"
41+
fi
42+
status=$(curl -sS -o /dev/null -w '%{http_code}' "https://registry.npmjs.org/@opencode%2fcli/$version")
43+
[ "$status" != 200 ] || die "@opencode/cli@$version is already published"
44+
fi
45+
46+
# What each channel builds and publishes.
47+
case "$channel" in
48+
latest) npm_tag=latest cli=true desktop=true node=false release=true ;;
49+
dev) npm_tag=dev cli=true desktop=false node=true release=false ;;
50+
beta) npm_tag="" cli=false desktop=true node=false release=false ;;
51+
pr) npm_tag=pr cli=true desktop=true node=true release=true ;;
52+
esac
53+
dry_run=false
54+
if [ "$channel" = pr ]; then dry_run=true; fi
55+
56+
{
57+
echo "version=$version"
58+
echo "channel=$channel"
59+
echo "npm_tag=$npm_tag"
60+
echo "dry_run=$dry_run"
61+
echo "cli=$cli"
62+
echo "desktop=$desktop"
63+
echo "node=$node"
64+
echo "release=$release"
65+
} | tee -a "$GITHUB_OUTPUT"
Collapse file

‎.github/release/publish-aur.sh‎

Copy file name to clipboard
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
# publish-aur.sh <build-npm dir>: updates opencode-beta on the AUR over SSH (AUR_KEY, pinned host key) and
3+
# registers the aur update artifact.
4+
. "$(dirname "$0")/lib.sh"
5+
6+
if ! dry_run; then
7+
mkdir -p ~/.ssh
8+
printf '%s\n' "$AUR_KEY" > ~/.ssh/aur
9+
chmod 600 ~/.ssh/aur
10+
echo "aur.archlinux.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEuBKrPzbawxA/k2g6NcyV5jmqwJ2s+zpgZGZ7tpLIcN" > ~/.ssh/known_hosts
11+
export GIT_SSH_COMMAND="ssh -i $HOME/.ssh/aur -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes"
12+
fi
13+
push_git ssh://[email protected]/opencode-beta.git "chore: update opencode-beta to ${OPENCODE_VERSION//-/.}" \
14+
bash "$release_dir/render-aur.sh" "$1"
15+
publish_update cli aur '{"package": "opencode-beta"}'
Collapse file

‎.github/release/publish-cli.sh‎

Copy file name to clipboard
+23Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
# publish-cli.sh <build-archives dir> <sign-macos dir> <sign-windows dir>: uploads the standalone CLI
3+
# archives to opencode.ai/files and registers the cli (and, off latest, cli-node) update artifacts.
4+
. "$(dirname "$0")/lib.sh"
5+
6+
archives=$1 macos=$2 windows=$3
7+
cli=()
8+
for target in linux-arm64 linux-x64 linux-x64-baseline linux-arm64-musl linux-x64-musl linux-x64-baseline-musl; do cli+=("$archives/opencode-$target.tar.gz"); done
9+
for target in darwin-arm64 darwin-x64 darwin-x64-baseline; do cli+=("$macos/opencode-$target.zip"); done
10+
for target in windows-arm64 windows-x64 windows-x64-baseline; do cli+=("$windows/opencode-$target.zip"); done
11+
12+
files=$(upload_files "${cli[@]}")
13+
publish_update cli npm '{"package": "@opencode/cli"}'
14+
publish_update cli opencode "$(jq -n --argjson files "$files" '{files: $files}')"
15+
16+
if [ "$OPENCODE_CHANNEL" != latest ]; then
17+
node=()
18+
for target in linux-arm64 linux-x64; do node+=("$archives/opencode2-node-$target.tar.gz"); done
19+
for target in darwin-arm64 windows-arm64 windows-x64; do node+=("$archives/opencode2-node-$target.zip"); done
20+
files=$(upload_files "${node[@]}")
21+
publish_update cli-node npm '{"package": "@opencode/cli-node"}'
22+
publish_update cli-node opencode "$(jq -n --argjson files "$files" '{files: $files}')"
23+
fi

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.