mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-16 21:15:57 +03:00
ci: read deploy and release secrets from aws secrets manager (#62954)
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
name: "Setup Git Committer"
|
||||
description: "Create app token and configure git user"
|
||||
inputs:
|
||||
opencode-app-id:
|
||||
description: "OpenCode GitHub App ID"
|
||||
required: true
|
||||
opencode-app-secret:
|
||||
description: "OpenCode GitHub App private key"
|
||||
required: true
|
||||
outputs:
|
||||
token:
|
||||
description: "GitHub App token"
|
||||
value: ${{ steps.apptoken.outputs.token }}
|
||||
app-slug:
|
||||
description: "GitHub App slug"
|
||||
value: ${{ steps.apptoken.outputs.app-slug }}
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Create app token
|
||||
id: apptoken
|
||||
uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2.2.2
|
||||
with:
|
||||
app-id: ${{ inputs.opencode-app-id }}
|
||||
private-key: ${{ inputs.opencode-app-secret }}
|
||||
owner: ${{ github.repository_owner }}
|
||||
|
||||
- name: Configure git user
|
||||
run: |
|
||||
slug="${{ steps.apptoken.outputs.app-slug }}"
|
||||
git config --global user.name "${slug}[bot]"
|
||||
git config --global user.email "${slug}[bot]@users.noreply.github.com"
|
||||
shell: bash
|
||||
|
||||
- name: Clear checkout auth
|
||||
run: |
|
||||
git config --local --unset-all http.https://github.com/.extraheader || true
|
||||
shell: bash
|
||||
|
||||
- name: Configure git remote
|
||||
run: |
|
||||
git remote set-url origin https://x-access-token:${{ steps.apptoken.outputs.token }}@github.com/${{ github.repository }}
|
||||
shell: bash
|
||||
@@ -90,6 +90,8 @@ r2_credentials() {
|
||||
export AWS_ACCESS_KEY_ID="$id"
|
||||
AWS_SECRET_ACCESS_KEY=$(printf '%s' "$CLOUDFLARE_API_TOKEN" | sha256 | cut -c1-64)
|
||||
export AWS_SECRET_ACCESS_KEY
|
||||
# These are R2's own credentials, so drop the role credentials the job assumed to read Secrets Manager.
|
||||
unset AWS_SESSION_TOKEN AWS_PROFILE AWS_REGION
|
||||
export AWS_DEFAULT_REGION=auto AWS_REQUEST_CHECKSUM_CALCULATION=when_required AWS_RESPONSE_CHECKSUM_VALIDATION=when_required
|
||||
# Larger parts mean fewer CompleteMultipartUpload parts for the 200-350 MB desktop builds.
|
||||
AWS_CONFIG_FILE=$(mktemp)
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
name: bot-docs-locale
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
paths:
|
||||
- packages/web/src/content/docs/*.mdx
|
||||
|
||||
jobs:
|
||||
sync-locales:
|
||||
if: false
|
||||
#if: github.actor != 'opencode-agent[bot]'
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
environment: release
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.ref_name }}
|
||||
|
||||
- name: Setup Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
|
||||
- name: Setup git committer
|
||||
id: committer
|
||||
uses: ./.github/actions/setup-git-committer
|
||||
with:
|
||||
opencode-app-id: ${{ vars.OPENCODE_APP_ID }}
|
||||
opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }}
|
||||
|
||||
- name: Compute changed English docs
|
||||
id: changes
|
||||
run: |
|
||||
FILES=$(git diff --name-only "${{ github.event.before }}" "${{ github.sha }}" -- ':(glob)packages/web/src/content/docs/*.mdx' || true)
|
||||
if [ -z "$FILES" ]; then
|
||||
echo "has_changes=false" >> "$GITHUB_OUTPUT"
|
||||
echo "No English docs changed in push range"
|
||||
exit 0
|
||||
fi
|
||||
echo "has_changes=true" >> "$GITHUB_OUTPUT"
|
||||
{
|
||||
echo "files<<EOF"
|
||||
echo "$FILES"
|
||||
echo "EOF"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Install OpenCode
|
||||
if: steps.changes.outputs.has_changes == 'true'
|
||||
run: curl -fsSL https://opencode.ai/install | bash
|
||||
|
||||
- name: Sync locale docs with OpenCode
|
||||
if: steps.changes.outputs.has_changes == 'true'
|
||||
env:
|
||||
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
|
||||
OPENCODE_CONFIG_CONTENT: |
|
||||
{
|
||||
"permission": {
|
||||
"*": "deny",
|
||||
"read": "allow",
|
||||
"edit": "allow",
|
||||
"glob": "allow",
|
||||
"task": "allow"
|
||||
}
|
||||
}
|
||||
run: |
|
||||
opencode run --agent docs --model opencode/gpt-5.3-codex <<'EOF'
|
||||
Update localized docs to match the latest English docs changes.
|
||||
|
||||
Changed English doc files:
|
||||
<changed_english_docs>
|
||||
${{ steps.changes.outputs.files }}
|
||||
</changed_english_docs>
|
||||
|
||||
Requirements:
|
||||
1. Update all relevant locale docs under packages/web/src/content/docs/<locale>/ so they reflect these English page changes.
|
||||
2. You MUST use the Task tool for translation work and launch subagents with subagent_type `translator` (defined in .opencode/agent/translator.md).
|
||||
3. Do not translate directly in the primary agent. Use translator subagent output as the source for locale text updates.
|
||||
4. Run translator subagent Task calls in parallel whenever file/locale translation work is independent.
|
||||
5. Use only the minimum tools needed for this task (read/glob, file edits, and translator Task). Do not use shell, web, search, or GitHub tools for translation work.
|
||||
6. Preserve frontmatter keys, internal links, code blocks, and existing locale-specific metadata unless the English change requires an update.
|
||||
7. Keep locale docs structure aligned with their corresponding English pages.
|
||||
8. Do not modify English source docs in packages/web/src/content/docs/*.mdx.
|
||||
9. If no locale updates are needed, make no changes.
|
||||
EOF
|
||||
|
||||
- name: Commit and push locale docs updates
|
||||
if: steps.changes.outputs.has_changes == 'true'
|
||||
run: |
|
||||
if [ -z "$(git status --porcelain)" ]; then
|
||||
echo "No locale docs changes to commit"
|
||||
exit 0
|
||||
fi
|
||||
git add -A
|
||||
git commit -m "docs(i18n): sync locale docs from english changes"
|
||||
git pull --rebase --autostash origin "$GITHUB_REF_NAME"
|
||||
git push origin HEAD:"$GITHUB_REF_NAME"
|
||||
@@ -19,6 +19,9 @@ jobs:
|
||||
if: github.repository == 'anomalyco/opencode' && (github.ref_name == 'dev' || github.ref_name == 'production')
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
environment: ${{ github.ref_name }}
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
|
||||
|
||||
@@ -28,8 +31,19 @@ jobs:
|
||||
working-directory: services/files
|
||||
run: bun run typecheck:tsc
|
||||
|
||||
- name: Configure AWS credentials
|
||||
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::604439173067:role/github/opencode-${{ github.ref_name }}
|
||||
role-session-name: opencode-${{ github.run_id }}
|
||||
aws-region: us-east-1
|
||||
|
||||
- name: Read deploy secrets
|
||||
uses: aws-actions/aws-secretsmanager-get-secrets@2297f9a879480a9e3af9b293ed15c70caf8e1c88 # v3.0.2
|
||||
with:
|
||||
secret-ids: CLOUDFLARE_API_TOKEN,opencode/${{ github.ref_name }}/CLOUDFLARE_API_TOKEN
|
||||
parse-json-secrets: false
|
||||
|
||||
- name: Deploy
|
||||
working-directory: services/files
|
||||
run: bun run deploy --env ${{ github.ref_name == 'production' && 'production' || 'dev' }}
|
||||
env:
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
|
||||
@@ -19,6 +19,9 @@ jobs:
|
||||
if: github.repository == 'anomalyco/opencode' && (github.ref_name == 'dev' || github.ref_name == 'production')
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
environment: ${{ github.ref_name }}
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
|
||||
|
||||
@@ -32,8 +35,19 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
|
||||
- name: Configure AWS credentials
|
||||
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::604439173067:role/github/opencode-${{ github.ref_name }}
|
||||
role-session-name: opencode-${{ github.run_id }}
|
||||
aws-region: us-east-1
|
||||
|
||||
- name: Read deploy secrets
|
||||
uses: aws-actions/aws-secretsmanager-get-secrets@2297f9a879480a9e3af9b293ed15c70caf8e1c88 # v3.0.2
|
||||
with:
|
||||
secret-ids: CLOUDFLARE_API_TOKEN,opencode/${{ github.ref_name }}/CLOUDFLARE_API_TOKEN
|
||||
parse-json-secrets: false
|
||||
|
||||
- name: Deploy
|
||||
working-directory: services/site
|
||||
run: bunx cf deploy --prebuilt --mode ${{ github.ref_name }}
|
||||
env:
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
|
||||
@@ -18,6 +18,9 @@ jobs:
|
||||
if: github.repository == 'anomalyco/opencode' && github.ref_name == 'production'
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
environment: production
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
|
||||
|
||||
@@ -27,8 +30,19 @@ jobs:
|
||||
working-directory: services/update
|
||||
run: bun run typecheck:tsc
|
||||
|
||||
- name: Configure AWS credentials
|
||||
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::604439173067:role/github/opencode-production
|
||||
role-session-name: opencode-${{ github.run_id }}
|
||||
aws-region: us-east-1
|
||||
|
||||
- name: Read deploy secrets
|
||||
uses: aws-actions/aws-secretsmanager-get-secrets@2297f9a879480a9e3af9b293ed15c70caf8e1c88 # v3.0.2
|
||||
with:
|
||||
secret-ids: CLOUDFLARE_API_TOKEN,opencode/production/CLOUDFLARE_API_TOKEN
|
||||
parse-json-secrets: false
|
||||
|
||||
- name: Deploy
|
||||
working-directory: services/update
|
||||
run: bun run deploy
|
||||
env:
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
|
||||
@@ -18,6 +18,9 @@ jobs:
|
||||
if: github.repository == 'anomalyco/opencode' && (github.ref_name == 'dev' || github.ref_name == 'production' || github.ref_name == 'beta')
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
environment: ${{ github.ref_name }}
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
|
||||
|
||||
@@ -27,13 +30,31 @@ jobs:
|
||||
with:
|
||||
node-version: "24"
|
||||
|
||||
# beta has no branch, environment or AWS role. Running it again needs a role trusting environment `beta` and
|
||||
# opencode/beta/CLOUDFLARE_API_TOKEN and opencode/beta/PLANETSCALE_SERVICE_TOKEN.
|
||||
- name: Configure AWS credentials
|
||||
if: github.ref_name != 'beta'
|
||||
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::604439173067:role/github/opencode-${{ github.ref_name }}
|
||||
role-session-name: opencode-${{ github.run_id }}
|
||||
aws-region: us-east-1
|
||||
|
||||
- name: Read deploy secrets
|
||||
if: github.ref_name != 'beta'
|
||||
uses: aws-actions/aws-secretsmanager-get-secrets@2297f9a879480a9e3af9b293ed15c70caf8e1c88 # v3.0.2
|
||||
with:
|
||||
secret-ids: |
|
||||
CLOUDFLARE_API_TOKEN,opencode/${{ github.ref_name }}/CLOUDFLARE_API_TOKEN
|
||||
PLANETSCALE_SERVICE_TOKEN,opencode/${{ github.ref_name }}/PLANETSCALE_SERVICE_TOKEN
|
||||
parse-json-secrets: false
|
||||
|
||||
- run: bun sst deploy --stage=${{ github.ref_name }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
PLANETSCALE_SERVICE_TOKEN_NAME: ${{ secrets.PLANETSCALE_SERVICE_TOKEN_NAME }}
|
||||
PLANETSCALE_SERVICE_TOKEN: ${{ secrets.PLANETSCALE_SERVICE_TOKEN }}
|
||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||
PLANETSCALE_SERVICE_TOKEN_NAME: ${{ vars.PLANETSCALE_SERVICE_TOKEN_NAME }}
|
||||
# Only the beta stage's web app uploads sourcemaps; packages/app skips the upload without a token.
|
||||
SENTRY_AUTH_TOKEN: ${{ github.ref_name == 'beta' && secrets.SENTRY_AUTH_TOKEN || '' }}
|
||||
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
|
||||
SENTRY_PROJECT: ${{ vars.WEB_SENTRY_PROJECT }}
|
||||
SENTRY_RELEASE: web@${{ github.sha }}
|
||||
@@ -47,12 +68,26 @@ jobs:
|
||||
if: github.repository == 'anomalyco/opencode' && github.ref_name != 'beta'
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
environment: ${{ github.ref_name }}
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
|
||||
|
||||
- uses: ./.github/actions/setup-bun
|
||||
|
||||
- name: Configure AWS credentials
|
||||
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::604439173067:role/github/opencode-${{ github.ref_name }}
|
||||
role-session-name: opencode-${{ github.run_id }}
|
||||
aws-region: us-east-1
|
||||
|
||||
- name: Read deploy secrets
|
||||
uses: aws-actions/aws-secretsmanager-get-secrets@2297f9a879480a9e3af9b293ed15c70caf8e1c88 # v3.0.2
|
||||
with:
|
||||
secret-ids: CLOUDFLARE_API_TOKEN,opencode/${{ github.ref_name }}/CLOUDFLARE_API_TOKEN
|
||||
parse-json-secrets: false
|
||||
|
||||
- run: bun run deploy:${{ github.ref_name }}
|
||||
working-directory: services/share
|
||||
env:
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
|
||||
@@ -1,733 +0,0 @@
|
||||
name: release-dry-run
|
||||
run-name: "${{ format('release {0}{1}', inputs.bump, inputs.version) }}"
|
||||
|
||||
# Builds are separated from signing and publishing.
|
||||
# - build-* jobs run repository code (`bun run build`, `bun run pack`) with no environment, secrets or id-token.
|
||||
# - sign-* and publish-* jobs run in the release environment, check out only .github/release/, and run those
|
||||
# scripts on verified artifacts, which they treat as data. They never execute repository code.
|
||||
# - plan decides version, channel and npm dist-tag from the event, inputs and ref; only a dispatch with a bump or
|
||||
# version on dev reaches latest.
|
||||
# .github/release/ and this file are the security boundary for releases.
|
||||
|
||||
# TEMPORARY copy of release.yml for this PR's dry run: GitHub does not start runs for the release.yml path on
|
||||
# pull requests (it is the old name of publish.yml). Delete before merging.
|
||||
on:
|
||||
pull_request:
|
||||
paths: [.github/workflows/release.yml, .github/workflows/release-dry-run.yml, .github/release/**]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ (inputs.bump || inputs.version) && 'release' || 'build' }}
|
||||
# Beta ships only the newest commit to the team. A cancelled beta run can leave unreferenced files in R2, but only
|
||||
# publish-desktop records a release, in one request.
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' || github.ref_name == 'beta' }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
jobs:
|
||||
plan:
|
||||
if: github.repository == 'anomalyco/opencode'
|
||||
runs-on: ubuntu-24.04
|
||||
permissions: {}
|
||||
outputs:
|
||||
version: ${{ steps.plan.outputs.version }}
|
||||
channel: ${{ steps.plan.outputs.channel }}
|
||||
npm_tag: ${{ steps.plan.outputs.npm_tag }}
|
||||
dry_run: ${{ steps.plan.outputs.dry_run }}
|
||||
cli: ${{ steps.plan.outputs.cli }}
|
||||
desktop: ${{ steps.plan.outputs.desktop }}
|
||||
node: ${{ steps.plan.outputs.node }}
|
||||
release: ${{ steps.plan.outputs.release }}
|
||||
steps:
|
||||
- &checkout-release
|
||||
name: Check out release scripts
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
|
||||
with:
|
||||
ref: ${{ github.sha }}
|
||||
sparse-checkout: /.github/release/
|
||||
sparse-checkout-cone-mode: false
|
||||
persist-credentials: false
|
||||
- id: plan
|
||||
name: Plan
|
||||
run: bash .github/release/plan-release.sh
|
||||
env:
|
||||
INPUT_BUMP: ${{ inputs.bump }}
|
||||
INPUT_VERSION: ${{ inputs.version }}
|
||||
|
||||
# A versioned release builds from a commit with its versions and changelog on the dispatched dev commit,
|
||||
# tagged v<version>. Runs git only.
|
||||
tag:
|
||||
needs: plan
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
contents: write
|
||||
env: &env
|
||||
OPENCODE_VERSION: ${{ needs.plan.outputs.version }}
|
||||
OPENCODE_CHANNEL: ${{ needs.plan.outputs.channel }}
|
||||
OPENCODE_NPM_TAG: ${{ needs.plan.outputs.npm_tag }}
|
||||
OPENCODE_DRY_RUN: ${{ needs.plan.outputs.dry_run }}
|
||||
outputs:
|
||||
sha: ${{ steps.tag.outputs.sha || github.sha }}
|
||||
steps:
|
||||
- name: Check out
|
||||
if: needs.plan.outputs.channel == 'latest'
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
|
||||
- id: tag
|
||||
name: Tag
|
||||
if: needs.plan.outputs.channel == 'latest'
|
||||
run: bash .github/release/tag-release.sh
|
||||
env:
|
||||
OPENCODE_RELEASE_NOTES: ${{ inputs.release_notes }}
|
||||
|
||||
# ---- Build: repository code; no environment, secrets or id-token --------------------------------------------
|
||||
|
||||
# Fetches the models.dev catalog once per run, so every CLI bundles the same copy.
|
||||
models-catalog:
|
||||
needs: [plan, tag]
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
timeout-minutes: 10
|
||||
env: *env
|
||||
steps:
|
||||
- &checkout
|
||||
name: Check out
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
|
||||
with:
|
||||
ref: ${{ needs.tag.outputs.sha }}
|
||||
persist-credentials: false
|
||||
- name: Set up Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
- name: Fetch
|
||||
run: bun packages/core/script/update-models-snapshot.ts .cache/models-catalog/api.json
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: models-catalog
|
||||
path: .cache/models-catalog/api.json
|
||||
if-no-files-found: error
|
||||
|
||||
build-cli:
|
||||
needs: [plan, tag, models-catalog]
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
timeout-minutes: 30
|
||||
env: *env
|
||||
steps:
|
||||
- *checkout
|
||||
- name: Set up Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
bun-version: 1.4.4
|
||||
- &download-models-catalog
|
||||
name: Download models catalog
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: models-catalog
|
||||
path: .cache/models-catalog
|
||||
- name: Build
|
||||
working-directory: packages/cli
|
||||
run: bun run build && rm -rf dist/.bun
|
||||
env:
|
||||
BUN_COMPILE_RELEASE: bun-v1.4.4
|
||||
OPENCODE_MODELS_SNAPSHOT: ${{ github.workspace }}/.cache/models-catalog/api.json
|
||||
OPENCODE_RELEASE_NOTES: ${{ needs.plan.outputs.channel == 'latest' && inputs.release_notes || '' }}
|
||||
GH_TOKEN: ${{ github.token }} # read-only; raises the rate limit for Bun release downloads
|
||||
- name: Verify bundled models catalog
|
||||
run: bun packages/cli/script/catalog-smoke.ts packages/cli/dist/cli-linux-x64/bin/opencode
|
||||
env:
|
||||
OPENCODE_MODELS_SNAPSHOT: ${{ github.workspace }}/.cache/models-catalog/api.json
|
||||
- name: Upload
|
||||
uses: ./.github/release/upload
|
||||
with:
|
||||
name: build-cli
|
||||
path: packages/cli/dist
|
||||
|
||||
build-node:
|
||||
needs: [plan, tag, models-catalog]
|
||||
if: needs.plan.outputs.node == 'true'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- { target: linux-arm64, host: blacksmith-4vcpu-ubuntu-2404-arm }
|
||||
- { target: linux-x64, host: blacksmith-4vcpu-ubuntu-2404 }
|
||||
- { target: darwin-arm64, host: macos-26 }
|
||||
- { target: windows-arm64, host: blacksmith-4vcpu-windows-2025 }
|
||||
- { target: windows-x64, host: blacksmith-4vcpu-windows-2025 }
|
||||
runs-on: ${{ matrix.host }}
|
||||
env: *env
|
||||
steps:
|
||||
- *checkout
|
||||
- name: Set up Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: "26.4.0"
|
||||
- *download-models-catalog
|
||||
- name: Build
|
||||
working-directory: packages/cli
|
||||
run: bun run build:node
|
||||
env:
|
||||
OPENCODE_TARGET: ${{ matrix.target }}
|
||||
OPENCODE_MODELS_SNAPSHOT: ${{ github.workspace }}/.cache/models-catalog/api.json
|
||||
- name: Test
|
||||
if: matrix.target != 'windows-arm64'
|
||||
working-directory: packages/cli
|
||||
run: bun run script/service-smoke.ts --node
|
||||
- name: Verify bundled models catalog
|
||||
if: matrix.target != 'windows-arm64'
|
||||
run: bun packages/cli/script/catalog-smoke.ts "packages/cli/dist/node/cli-node-$OPENCODE_TARGET/bin/opencode2-node$EXE"
|
||||
env:
|
||||
OPENCODE_TARGET: ${{ matrix.target }}
|
||||
EXE: ${{ startsWith(matrix.target, 'windows') && '.exe' || '' }}
|
||||
OPENCODE_MODELS_SNAPSHOT: ${{ github.workspace }}/.cache/models-catalog/api.json
|
||||
- name: Upload
|
||||
uses: ./.github/release/upload
|
||||
with:
|
||||
name: build-node-${{ matrix.target }}
|
||||
path: packages/cli/dist/node
|
||||
|
||||
# `bun run pack` packs every npm package into dist/npm and the Linux and Node CLI archives into dist/archives.
|
||||
# The macOS and Windows CLI packages and archives are re-packed after signing.
|
||||
build-npm:
|
||||
needs: [plan, tag, build-cli, build-node]
|
||||
if: ${{ !cancelled() && !failure() && needs.plan.outputs.cli == 'true' }}
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
timeout-minutes: 30
|
||||
env: *env
|
||||
steps:
|
||||
- *checkout
|
||||
- name: Set up Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
- &download-cli
|
||||
name: Download
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: build-cli
|
||||
path: packages/cli/dist
|
||||
- name: Download Node CLI
|
||||
if: needs.plan.outputs.node == 'true'
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
pattern: build-node-*
|
||||
path: packages/cli/dist/node
|
||||
merge-multiple: true
|
||||
- name: Pack
|
||||
run: rm packages/cli/dist/SHA256SUMS && bun run pack
|
||||
- name: Upload
|
||||
uses: ./.github/release/upload
|
||||
with:
|
||||
name: build-npm
|
||||
path: dist/npm
|
||||
- name: Upload archives
|
||||
uses: ./.github/release/upload
|
||||
with:
|
||||
name: build-archives
|
||||
path: dist/archives
|
||||
|
||||
build-docker:
|
||||
needs: [plan, tag, build-cli]
|
||||
if: needs.plan.outputs.release == 'true'
|
||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||
env: *env
|
||||
steps:
|
||||
- *checkout
|
||||
- *download-cli
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3.7.0
|
||||
- name: Set up Buildx
|
||||
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
|
||||
- name: Set up Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
- name: Pack
|
||||
working-directory: packages/cli
|
||||
run: bun run pack:docker
|
||||
- name: Upload
|
||||
uses: ./.github/release/upload
|
||||
with:
|
||||
name: build-docker
|
||||
path: dist/docker
|
||||
|
||||
# macOS and Windows pack an unsigned app; Linux packs the final AppImage, deb and rpm.
|
||||
# Dev and beta package macOS x64 on Apple Silicon and Windows arm64 on Blacksmith for speed. electron-builder's
|
||||
# afterPack rejects a bundle whose CLI or node-pty does not match the target CPU.
|
||||
build-desktop:
|
||||
needs: [plan, tag, build-cli]
|
||||
if: needs.plan.outputs.desktop == 'true'
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read # beta builds read who made each change and what it does for "What's new in beta"
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- target: darwin-x64
|
||||
host: ${{ (needs.plan.outputs.channel == 'dev' || needs.plan.outputs.channel == 'beta') && 'macos-26' || 'macos-26-intel' }}
|
||||
install: ${{ (needs.plan.outputs.channel == 'dev' || needs.plan.outputs.channel == 'beta') && '--os=darwin --cpu=*' || '--os=darwin --cpu=x64' }}
|
||||
- { target: darwin-arm64, host: macos-26, install: --os=darwin --cpu=arm64 }
|
||||
# github-hosted: blacksmith lacks the ARM64 MSVC cross-compilation toolchain
|
||||
- target: windows-arm64
|
||||
host: ${{ (needs.plan.outputs.channel == 'dev' || needs.plan.outputs.channel == 'beta') && 'blacksmith-4vcpu-windows-2025' || 'windows-2025' }}
|
||||
install: --cpu=*
|
||||
- { target: windows-x64, host: blacksmith-4vcpu-windows-2025 }
|
||||
- { target: linux-x64, host: blacksmith-4vcpu-ubuntu-2404 }
|
||||
- { target: linux-arm64, host: blacksmith-4vcpu-ubuntu-2404-arm }
|
||||
runs-on: ${{ matrix.host }}
|
||||
env: *env
|
||||
steps:
|
||||
- *checkout
|
||||
- *download-cli
|
||||
- name: Set up Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
install-flags: ${{ matrix.install }}
|
||||
- name: Set up rpm
|
||||
if: runner.os == 'Linux'
|
||||
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends rpm
|
||||
# The beta build embeds the subjects of its newest commits for "What's new in beta"
|
||||
# (packages/desktop/script/beta-notes.ts). Commits without file contents are enough.
|
||||
- name: Fetch beta history
|
||||
if: needs.plan.outputs.channel == 'beta'
|
||||
run: git fetch --no-tags --filter=blob:none --depth=300 origin "$SHA"
|
||||
env:
|
||||
SHA: ${{ needs.tag.outputs.sha }}
|
||||
# Dev and beta trade larger packages for faster packaging. fpm sets XZ_OPT for the deb and rpm level, but xz
|
||||
# still reads XZ_DEFAULTS, so it uses every CPU.
|
||||
- name: Preview packaging settings
|
||||
if: (needs.plan.outputs.channel == 'dev' || needs.plan.outputs.channel == 'beta') && runner.os == 'Linux'
|
||||
run: echo "XZ_DEFAULTS=-T0" >> "$GITHUB_ENV"
|
||||
- name: Build
|
||||
working-directory: packages/desktop
|
||||
run: bun run build
|
||||
env:
|
||||
OPENCODE_TARGET: ${{ matrix.target }}
|
||||
NODE_OPTIONS: --max-old-space-size=4096
|
||||
VITE_SENTRY_DSN: ${{ vars.WEB_SENTRY_DSN }}
|
||||
VITE_SENTRY_ENVIRONMENT: ${{ needs.plan.outputs.channel == 'latest' && 'production' || needs.plan.outputs.channel }}
|
||||
VITE_SENTRY_RELEASE: desktop@${{ needs.plan.outputs.version }}
|
||||
GITHUB_TOKEN: ${{ github.token }} # read-only; beta notes read pull request authors and descriptions
|
||||
- name: Pack
|
||||
working-directory: packages/desktop
|
||||
timeout-minutes: 60
|
||||
run: bun run pack
|
||||
env:
|
||||
OPENCODE_TARGET: ${{ matrix.target }}
|
||||
- name: Upload
|
||||
uses: ./.github/release/upload
|
||||
with:
|
||||
name: build-desktop-${{ matrix.target }}
|
||||
path: dist/desktop
|
||||
|
||||
# Packs the NSIS installer around the signed app. This runs repository config, so it is a build job; the
|
||||
# installer is signed next.
|
||||
build-desktop-windows-installer:
|
||||
needs: [plan, tag, sign-windows]
|
||||
if: ${{ !cancelled() && !failure() && needs.plan.outputs.desktop == 'true' }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- target: windows-arm64
|
||||
host: ${{ (needs.plan.outputs.channel == 'dev' || needs.plan.outputs.channel == 'beta') && 'blacksmith-4vcpu-windows-2025' || 'windows-2025' }}
|
||||
install: --cpu=*
|
||||
- { target: windows-x64, host: blacksmith-4vcpu-windows-2025 }
|
||||
runs-on: ${{ matrix.host }}
|
||||
env: *env
|
||||
steps:
|
||||
- *checkout
|
||||
- name: Set up Bun
|
||||
uses: ./.github/actions/setup-bun
|
||||
with:
|
||||
install-flags: ${{ matrix.install }}
|
||||
- name: Download
|
||||
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
|
||||
with:
|
||||
name: sign-desktop-${{ matrix.target }}
|
||||
path: ${{ runner.temp }}/app
|
||||
- name: Pack
|
||||
working-directory: packages/desktop
|
||||
timeout-minutes: 30
|
||||
run: bun run pack
|
||||
env:
|
||||
OPENCODE_TARGET: ${{ matrix.target }}
|
||||
OPENCODE_DESKTOP_APP: ${{ runner.temp }}/app/app
|
||||
- name: Upload
|
||||
uses: ./.github/release/upload
|
||||
with:
|
||||
name: build-desktop-windows-installer-${{ matrix.target }}
|
||||
path: dist/desktop
|
||||
|
||||
# ---- Sign: release environment; only .github/release/ is checked out ----------------------------------------
|
||||
# Pull requests run sign and publish jobs without an environment, so steps that need a secret skip or dry-run.
|
||||
|
||||
# Signs the macOS CLI; signs the desktop apps inside-out, notarizes them in one submission, staples them, and
|
||||
# only then builds the zip, dmg and .app.tar.gz from the stapled apps.
|
||||
sign-macos:
|
||||
needs: [plan, build-npm, build-desktop]
|
||||
if: ${{ !cancelled() && !failure() && (needs.plan.outputs.cli == 'true' || needs.plan.outputs.desktop == 'true') }}
|
||||
runs-on: macos-26
|
||||
timeout-minutes: 90
|
||||
environment: ${{ needs.plan.outputs.dry_run != 'true' && 'release' || '' }}
|
||||
env: *env
|
||||
outputs:
|
||||
digest: ${{ steps.upload.outputs.digest }}
|
||||
steps:
|
||||
- *checkout-release
|
||||
- name: Download
|
||||
uses: ./.github/release/download
|
||||
with:
|
||||
pattern: "{build-npm,build-desktop-darwin-*}"
|
||||
# The certificate has no password, which apple-actions/import-codesign-certs rejects. The sign scripts look up
|
||||
# the identity in build.keychain, and codesign finds the key through the user search list.
|
||||
- name: Import certificate
|
||||
if: needs.plan.outputs.dry_run != 'true'
|
||||
run: |
|
||||
cert="$RUNNER_TEMP/cert.p12"
|
||||
keychain_password=$(openssl rand -base64 32)
|
||||
printf '%s' "$APPLE_SIGNING_CERTIFICATE" | base64 --decode > "$cert"
|
||||
security create-keychain -p "$keychain_password" build.keychain
|
||||
security set-keychain-settings -lut 21600 build.keychain
|
||||
security unlock-keychain -p "$keychain_password" build.keychain
|
||||
security import "$cert" -k build.keychain -P "" -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productsign
|
||||
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$keychain_password" build.keychain > /dev/null
|
||||
security list-keychains -d user -s build.keychain $(security list-keychains -d user | tr -d '"')
|
||||
rm -f "$cert"
|
||||
env:
|
||||
APPLE_SIGNING_CERTIFICATE: ${{ secrets.APPLE_SIGNING_CERTIFICATE }}
|
||||
- name: Sign CLI
|
||||
if: needs.plan.outputs.cli == 'true'
|
||||
run: bash .github/release/sign-cli-macos.sh "$RUNNER_TEMP/in/build-npm" "$RUNNER_TEMP/out"
|
||||
- name: Sign desktop
|
||||
if: needs.plan.outputs.desktop == 'true'
|
||||
run: |
|
||||
bash .github/release/sign-desktop-macos.sh "$RUNNER_TEMP/out" \
|
||||
"$RUNNER_TEMP"/in/build-desktop-darwin-*/opencode-desktop-mac-*.app.tar
|
||||
env:
|
||||
APPLE_NOTARY_KEY: ${{ secrets.APPLE_NOTARY_KEY }}
|
||||
APPLE_NOTARY_KEY_ID: ${{ vars.APPLE_NOTARY_KEY_ID }}
|
||||
APPLE_NOTARY_ISSUER_ID: ${{ vars.APPLE_NOTARY_ISSUER_ID }}
|
||||
- id: upload
|
||||
name: Upload
|
||||
uses: ./.github/release/upload
|
||||
with:
|
||||
name: sign-macos
|
||||
path: ${{ runner.temp }}/out
|
||||
- name: Delete keychain
|
||||
if: always() && needs.plan.outputs.dry_run != 'true'
|
||||
run: |
|
||||
rm -f "$RUNNER_TEMP/cert.p12"
|
||||
security delete-keychain build.keychain || true
|
||||
|
||||
# Signs the Windows CLI and every executable and native module of the unpacked desktop apps.
|
||||
sign-windows:
|
||||
needs: [plan, build-npm, build-desktop]
|
||||
if: ${{ !cancelled() && !failure() && (needs.plan.outputs.cli == 'true' || needs.plan.outputs.desktop == 'true') }}
|
||||
runs-on: windows-2025
|
||||
environment: ${{ needs.plan.outputs.dry_run != 'true' && 'release' || '' }}
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
env: *env
|
||||
outputs:
|
||||
digest: ${{ steps.upload.outputs.digest }}
|
||||
steps:
|
||||
- *checkout-release
|
||||
- name: Download
|
||||
uses: ./.github/release/download
|
||||
with:
|
||||
pattern: "{build-npm,build-desktop-windows-*}"
|
||||
- name: Unpack
|
||||
run: bash .github/release/unpack-windows.sh "$RUNNER_TEMP/in" "$RUNNER_TEMP/work"
|
||||
- &azure-login
|
||||
name: Log in to Azure
|
||||
if: needs.plan.outputs.dry_run != 'true'
|
||||
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2.3.0
|
||||
with:
|
||||
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
||||
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
||||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
||||
- &azure-sign
|
||||
name: Sign
|
||||
if: needs.plan.outputs.dry_run != 'true'
|
||||
uses: azure/artifact-signing-action@b443cf8ea4124818d2ea9f043cba29fc3ec47b16 # v1.2.0
|
||||
with:
|
||||
endpoint: ${{ secrets.AZURE_TRUSTED_SIGNING_ENDPOINT }}
|
||||
signing-account-name: ${{ secrets.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
|
||||
certificate-profile-name: ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE }}
|
||||
files-folder: ${{ runner.temp }}\work
|
||||
files-folder-filter: exe,node
|
||||
files-folder-recurse: true
|
||||
exclude-environment-credential: true
|
||||
exclude-workload-identity-credential: true
|
||||
exclude-managed-identity-credential: true
|
||||
exclude-shared-token-cache-credential: true
|
||||
exclude-visual-studio-credential: true
|
||||
exclude-visual-studio-code-credential: true
|
||||
exclude-azure-cli-credential: false
|
||||
exclude-azure-powershell-credential: true
|
||||
exclude-azure-developer-cli-credential: true
|
||||
exclude-interactive-browser-credential: true
|
||||
- name: Repack
|
||||
run: bash .github/release/repack-windows.sh "$RUNNER_TEMP/work" "$RUNNER_TEMP/out"
|
||||
- id: upload
|
||||
name: Upload
|
||||
if: needs.plan.outputs.cli == 'true'
|
||||
uses: ./.github/release/upload
|
||||
with:
|
||||
name: sign-windows
|
||||
path: ${{ runner.temp }}/out
|
||||
- name: Upload arm64 app
|
||||
if: needs.plan.outputs.desktop == 'true'
|
||||
uses: ./.github/release/upload
|
||||
with:
|
||||
name: sign-desktop-windows-arm64
|
||||
path: ${{ runner.temp }}/work/desktop-windows-arm64
|
||||
- name: Upload x64 app
|
||||
if: needs.plan.outputs.desktop == 'true'
|
||||
uses: ./.github/release/upload
|
||||
with:
|
||||
name: sign-desktop-windows-x64
|
||||
path: ${{ runner.temp }}/work/desktop-windows-x64
|
||||
|
||||
sign-desktop-windows-installer:
|
||||
needs: [plan, build-desktop-windows-installer]
|
||||
if: ${{ !cancelled() && !failure() && needs.plan.outputs.desktop == 'true' }}
|
||||
runs-on: windows-2025
|
||||
environment: ${{ needs.plan.outputs.dry_run != 'true' && 'release' || '' }}
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
env: *env
|
||||
outputs:
|
||||
digest: ${{ steps.upload.outputs.digest }}
|
||||
steps:
|
||||
- *checkout-release
|
||||
- name: Download
|
||||
uses: ./.github/release/download
|
||||
with:
|
||||
pattern: build-desktop-windows-installer-*
|
||||
- name: Unpack
|
||||
run: mkdir -p "$RUNNER_TEMP/work" && cp "$RUNNER_TEMP"/in/build-desktop-windows-installer-*/*.exe "$RUNNER_TEMP/work/"
|
||||
- *azure-login
|
||||
- *azure-sign
|
||||
- name: Repack
|
||||
run: bash .github/release/repack-windows.sh "$RUNNER_TEMP/work" "$RUNNER_TEMP/out"
|
||||
- id: upload
|
||||
name: Upload
|
||||
uses: ./.github/release/upload
|
||||
with:
|
||||
name: sign-desktop-windows-installer
|
||||
path: ${{ runner.temp }}/work
|
||||
|
||||
# ---- Publish: release environment; only .github/release/ is checked out -------------------------------------
|
||||
# Destinations, names and channels come from plan and the scripts, never from artifacts.
|
||||
|
||||
# Build provenance for the npm tarballs and Linux archives. No secrets; id-token only for Sigstore.
|
||||
publish-attestations:
|
||||
needs: [plan, build-npm]
|
||||
if: ${{ !cancelled() && !failure() && needs.plan.outputs.cli == 'true' && needs.plan.outputs.dry_run != 'true' }}
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
attestations: write
|
||||
steps:
|
||||
- *checkout-release
|
||||
- name: Download
|
||||
uses: ./.github/release/download
|
||||
with:
|
||||
pattern: "{build-npm,build-archives}"
|
||||
- name: Sign
|
||||
uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2
|
||||
with:
|
||||
subject-path: |
|
||||
${{ runner.temp }}/in/build-npm/*.tgz
|
||||
${{ runner.temp }}/in/build-archives/opencode*
|
||||
|
||||
publish-npm:
|
||||
needs: [plan, sign-macos, sign-windows, publish-attestations]
|
||||
if: ${{ !cancelled() && !failure() && needs.plan.outputs.cli == 'true' }}
|
||||
runs-on: ubuntu-24.04
|
||||
environment: ${{ needs.plan.outputs.dry_run != 'true' && 'release' || '' }}
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
attestations: read
|
||||
env: *env
|
||||
steps:
|
||||
- *checkout-release
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: "24.11.0"
|
||||
- &download-signed-cli
|
||||
name: Download
|
||||
uses: ./.github/release/download
|
||||
with:
|
||||
pattern: "{build-npm,build-archives,sign-macos,sign-windows}"
|
||||
digests: sign-macos=${{ needs.sign-macos.outputs.digest }} sign-windows=${{ needs.sign-windows.outputs.digest }}
|
||||
- name: Publish
|
||||
run: bash .github/release/publish-npm.sh "$RUNNER_TEMP/in/build-npm" "$RUNNER_TEMP/in/sign-macos" "$RUNNER_TEMP/in/sign-windows"
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
|
||||
publish-cli:
|
||||
needs: [plan, sign-macos, sign-windows, publish-npm]
|
||||
if: ${{ !cancelled() && !failure() && needs.plan.outputs.cli == 'true' }}
|
||||
runs-on: ubuntu-24.04
|
||||
environment: ${{ needs.plan.outputs.dry_run != 'true' && 'release' || '' }}
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
env: *env
|
||||
steps:
|
||||
- *checkout-release
|
||||
- *download-signed-cli
|
||||
- name: Publish
|
||||
run: bash .github/release/publish-cli.sh "$RUNNER_TEMP/in/build-archives" "$RUNNER_TEMP/in/sign-macos" "$RUNNER_TEMP/in/sign-windows"
|
||||
env: &cloudflare
|
||||
CLOUDFLARE_ACCOUNT_ID: 15d29c8639fd3733b1b5486a2acfd968
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
|
||||
publish-desktop:
|
||||
needs: [plan, sign-macos, sign-desktop-windows-installer]
|
||||
if: ${{ !cancelled() && !failure() && needs.plan.outputs.desktop == 'true' }}
|
||||
runs-on: ubuntu-24.04
|
||||
environment: ${{ needs.plan.outputs.dry_run != 'true' && 'release' || '' }}
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
env: *env
|
||||
steps:
|
||||
- *checkout-release
|
||||
- name: Download
|
||||
uses: ./.github/release/download
|
||||
with:
|
||||
pattern: "{sign-macos,sign-desktop-windows-installer,build-desktop-linux-*}"
|
||||
digests: sign-macos=${{ needs.sign-macos.outputs.digest }} sign-desktop-windows-installer=${{ needs.sign-desktop-windows-installer.outputs.digest }}
|
||||
- name: Publish
|
||||
run: |
|
||||
bash .github/release/publish-desktop.sh "$RUNNER_TEMP/in/sign-macos" "$RUNNER_TEMP/in/sign-desktop-windows-installer" \
|
||||
"$RUNNER_TEMP/in/build-desktop-linux-x64" "$RUNNER_TEMP/in/build-desktop-linux-arm64"
|
||||
env: *cloudflare
|
||||
|
||||
publish-docker:
|
||||
needs: [plan, build-docker]
|
||||
if: ${{ !cancelled() && !failure() && needs.plan.outputs.release == 'true' }}
|
||||
runs-on: ubuntu-24.04
|
||||
environment: ${{ needs.plan.outputs.dry_run != 'true' && 'release' || '' }}
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
env: *env
|
||||
steps:
|
||||
- *checkout-release
|
||||
- name: Download
|
||||
uses: ./.github/release/download
|
||||
with:
|
||||
pattern: build-docker
|
||||
- name: Publish
|
||||
run: bash .github/release/publish-docker.sh "$RUNNER_TEMP/in/build-docker"
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
|
||||
publish-homebrew:
|
||||
needs: [plan, sign-macos, sign-windows, publish-cli]
|
||||
if: ${{ !cancelled() && !failure() && needs.plan.outputs.release == 'true' }}
|
||||
runs-on: ubuntu-24.04
|
||||
environment: ${{ needs.plan.outputs.dry_run != 'true' && 'release' || '' }}
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
env: *env
|
||||
steps:
|
||||
- *checkout-release
|
||||
- *download-signed-cli
|
||||
- name: Publish
|
||||
run: bash .github/release/publish-homebrew.sh "$RUNNER_TEMP/in/sign-macos" "$RUNNER_TEMP/in/build-archives"
|
||||
env:
|
||||
HOMEBREW_TAP_DEPLOY_KEY: ${{ secrets.HOMEBREW_TAP_DEPLOY_KEY }}
|
||||
|
||||
# The AUR package installs the published npm tarballs, so it follows the npm publish.
|
||||
publish-aur:
|
||||
needs: [plan, sign-macos, sign-windows, publish-npm]
|
||||
if: ${{ !cancelled() && !failure() && needs.plan.outputs.release == 'true' }}
|
||||
runs-on: ubuntu-24.04
|
||||
environment: ${{ needs.plan.outputs.dry_run != 'true' && 'release' || '' }}
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
env: *env
|
||||
steps:
|
||||
- *checkout-release
|
||||
- *download-signed-cli
|
||||
- name: Publish
|
||||
run: bash .github/release/publish-aur.sh "$RUNNER_TEMP/in/build-npm"
|
||||
env:
|
||||
AUR_KEY: ${{ secrets.AUR_KEY }}
|
||||
|
||||
# WinGet manifests as data. Submission to microsoft/winget-pkgs stays paused until the packages are accepted.
|
||||
publish-winget:
|
||||
needs: [plan, sign-windows, sign-desktop-windows-installer]
|
||||
if: ${{ !cancelled() && !failure() && needs.plan.outputs.release == 'true' }}
|
||||
runs-on: ubuntu-24.04
|
||||
env: *env
|
||||
steps:
|
||||
- *checkout-release
|
||||
- name: Download
|
||||
uses: ./.github/release/download
|
||||
with:
|
||||
pattern: "{sign-windows,sign-desktop-windows-installer}"
|
||||
digests: sign-windows=${{ needs.sign-windows.outputs.digest }} sign-desktop-windows-installer=${{ needs.sign-desktop-windows-installer.outputs.digest }}
|
||||
- name: Render
|
||||
run: bash .github/release/render-winget.sh "$RUNNER_TEMP/in/sign-windows" "$RUNNER_TEMP/in/sign-desktop-windows-installer" "$RUNNER_TEMP/out"
|
||||
- name: Upload
|
||||
uses: ./.github/release/upload
|
||||
with:
|
||||
name: publish-winget
|
||||
path: ${{ runner.temp }}/out
|
||||
|
||||
publish-github-release:
|
||||
needs: [plan, sign-macos, sign-windows, sign-desktop-windows-installer, publish-cli, publish-desktop]
|
||||
if: ${{ !cancelled() && !failure() && needs.plan.outputs.release == 'true' }}
|
||||
runs-on: ubuntu-24.04
|
||||
environment: ${{ needs.plan.outputs.dry_run != 'true' && 'release' || '' }}
|
||||
permissions:
|
||||
contents: write
|
||||
env: *env
|
||||
steps:
|
||||
- *checkout-release
|
||||
- name: Download
|
||||
uses: ./.github/release/download
|
||||
with:
|
||||
pattern: "{build-archives,build-desktop-linux-*,sign-macos,sign-windows,sign-desktop-windows-installer}"
|
||||
digests: >-
|
||||
sign-macos=${{ needs.sign-macos.outputs.digest }} sign-windows=${{ needs.sign-windows.outputs.digest }}
|
||||
sign-desktop-windows-installer=${{ needs.sign-desktop-windows-installer.outputs.digest }}
|
||||
- name: Publish
|
||||
run: bash .github/release/publish-github-release.sh "$RUNNER_TEMP"/in/*
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
GH_REPO: ${{ github.repository }}
|
||||
OPENCODE_RELEASE_NOTES: ${{ inputs.release_notes }}
|
||||
|
||||
# Brings the release commit back to dev. Pushing to dev is blocked by rulesets, so it opens a PR.
|
||||
publish-version-pr:
|
||||
needs: [plan, tag, publish-npm, publish-cli, publish-desktop, publish-github-release]
|
||||
if: ${{ !cancelled() && !failure() && needs.plan.outputs.channel == 'latest' }}
|
||||
runs-on: ubuntu-24.04
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
env: *env
|
||||
steps:
|
||||
- *checkout-release
|
||||
- name: Publish
|
||||
run: bash .github/release/publish-version-pr.sh "$SHA"
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
GH_REPO: ${{ github.repository }}
|
||||
SHA: ${{ needs.tag.outputs.sha }}
|
||||
+112
-16
@@ -5,6 +5,9 @@ run-name: "${{ format('release {0}{1}', inputs.bump, inputs.version) }}"
|
||||
# - build-* jobs run repository code (`bun run build`, `bun run pack`) with no environment, secrets or id-token.
|
||||
# - sign-* and publish-* jobs run in the release environment, check out only .github/release/, and run those
|
||||
# scripts on verified artifacts, which they treat as data. They never execute repository code.
|
||||
# - sign-* and publish-* jobs read their secrets from AWS Secrets Manager: they assume
|
||||
# arn:aws:iam::604439173067:role/github/opencode-release over GitHub OIDC in the release environment. The Azure
|
||||
# trusted signing ids are repository variables.
|
||||
# - plan decides version, channel and npm dist-tag from the event, inputs and ref; only a dispatch with a bump or
|
||||
# version on dev reaches latest.
|
||||
# .github/release/ and this file are the security boundary for releases.
|
||||
@@ -83,6 +86,7 @@ jobs:
|
||||
environment: ${{ needs.plan.outputs.channel == 'latest' && needs.plan.outputs.dry_run != 'true' && 'release' || '' }}
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
env: &env
|
||||
OPENCODE_VERSION: ${{ needs.plan.outputs.version }}
|
||||
OPENCODE_CHANNEL: ${{ needs.plan.outputs.channel }}
|
||||
@@ -91,11 +95,28 @@ jobs:
|
||||
outputs:
|
||||
sha: ${{ steps.tag.outputs.sha || github.sha }}
|
||||
steps:
|
||||
# The tag is pushable only with the release deploy key, so without the release environment there is nothing
|
||||
# to fetch and the checkout below falls back to the workflow token.
|
||||
- name: Configure AWS credentials
|
||||
if: needs.plan.outputs.channel == 'latest' && needs.plan.outputs.dry_run != 'true'
|
||||
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::604439173067:role/github/opencode-release
|
||||
role-session-name: opencode-${{ github.run_id }}
|
||||
aws-region: us-east-1
|
||||
|
||||
- name: Read release tag key
|
||||
if: needs.plan.outputs.channel == 'latest' && needs.plan.outputs.dry_run != 'true'
|
||||
uses: aws-actions/aws-secretsmanager-get-secrets@2297f9a879480a9e3af9b293ed15c70caf8e1c88 # v3.0.2
|
||||
with:
|
||||
secret-ids: RELEASE_TAG_KEY,opencode/release/RELEASE_TAG_KEY
|
||||
parse-json-secrets: false
|
||||
|
||||
- name: Check out
|
||||
if: needs.plan.outputs.channel == 'latest'
|
||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
|
||||
with:
|
||||
ssh-key: ${{ secrets.RELEASE_TAG_KEY }}
|
||||
ssh-key: ${{ env.RELEASE_TAG_KEY }}
|
||||
- id: tag
|
||||
name: Tag
|
||||
if: needs.plan.outputs.channel == 'latest'
|
||||
@@ -391,6 +412,9 @@ jobs:
|
||||
runs-on: macos-26
|
||||
timeout-minutes: 90
|
||||
environment: ${{ needs.plan.outputs.dry_run != 'true' && 'release' || '' }}
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
env: *env
|
||||
outputs:
|
||||
digest: ${{ steps.upload.outputs.digest }}
|
||||
@@ -400,6 +424,21 @@ jobs:
|
||||
uses: ./.github/release/download
|
||||
with:
|
||||
pattern: "{build-npm,build-desktop-darwin-*}"
|
||||
- name: Configure AWS credentials
|
||||
if: needs.plan.outputs.dry_run != 'true'
|
||||
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::604439173067:role/github/opencode-release
|
||||
role-session-name: opencode-${{ github.run_id }}
|
||||
aws-region: us-east-1
|
||||
- name: Read signing secrets
|
||||
if: needs.plan.outputs.dry_run != 'true'
|
||||
uses: aws-actions/aws-secretsmanager-get-secrets@2297f9a879480a9e3af9b293ed15c70caf8e1c88 # v3.0.2
|
||||
with:
|
||||
secret-ids: |
|
||||
APPLE_SIGNING_CERTIFICATE,shared/APPLE_SIGNING_CERTIFICATE
|
||||
APPLE_NOTARY_KEY,shared/APPLE_NOTARY_KEY
|
||||
parse-json-secrets: false
|
||||
# The certificate has no password, which apple-actions/import-codesign-certs rejects. The sign scripts look up
|
||||
# the identity in build.keychain, and codesign finds the key through the user search list.
|
||||
- name: Import certificate
|
||||
@@ -415,8 +454,6 @@ jobs:
|
||||
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$keychain_password" build.keychain > /dev/null
|
||||
security list-keychains -d user -s build.keychain $(security list-keychains -d user | tr -d '"')
|
||||
rm -f "$cert"
|
||||
env:
|
||||
APPLE_SIGNING_CERTIFICATE: ${{ secrets.APPLE_SIGNING_CERTIFICATE }}
|
||||
- name: Sign CLI
|
||||
if: needs.plan.outputs.cli == 'true'
|
||||
run: bash .github/release/sign-cli-macos.sh "$RUNNER_TEMP/in/build-npm" "$RUNNER_TEMP/out"
|
||||
@@ -426,7 +463,6 @@ jobs:
|
||||
bash .github/release/sign-desktop-macos.sh "$RUNNER_TEMP/out" \
|
||||
"$RUNNER_TEMP"/in/build-desktop-darwin-*/opencode-desktop-mac-*.app.tar
|
||||
env:
|
||||
APPLE_NOTARY_KEY: ${{ secrets.APPLE_NOTARY_KEY }}
|
||||
APPLE_NOTARY_KEY_ID: ${{ vars.APPLE_NOTARY_KEY_ID }}
|
||||
APPLE_NOTARY_ISSUER_ID: ${{ vars.APPLE_NOTARY_ISSUER_ID }}
|
||||
- id: upload
|
||||
@@ -466,17 +502,17 @@ jobs:
|
||||
if: needs.plan.outputs.dry_run != 'true'
|
||||
uses: azure/login@a457da9ea143d694b1b9c7c869ebb04ebe844ef5 # v2.3.0
|
||||
with:
|
||||
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
||||
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
||||
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
||||
client-id: ${{ vars.AZURE_CLIENT_ID }}
|
||||
tenant-id: ${{ vars.AZURE_TENANT_ID }}
|
||||
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
|
||||
- &azure-sign
|
||||
name: Sign
|
||||
if: needs.plan.outputs.dry_run != 'true'
|
||||
uses: azure/artifact-signing-action@b443cf8ea4124818d2ea9f043cba29fc3ec47b16 # v1.2.0
|
||||
with:
|
||||
endpoint: ${{ secrets.AZURE_TRUSTED_SIGNING_ENDPOINT }}
|
||||
signing-account-name: ${{ secrets.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
|
||||
certificate-profile-name: ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE }}
|
||||
endpoint: ${{ vars.AZURE_TRUSTED_SIGNING_ENDPOINT }}
|
||||
signing-account-name: ${{ vars.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
|
||||
certificate-profile-name: ${{ vars.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE }}
|
||||
files-folder: ${{ runner.temp }}\work
|
||||
files-folder-filter: exe,node
|
||||
files-folder-recurse: true
|
||||
@@ -606,11 +642,23 @@ jobs:
|
||||
steps:
|
||||
- *checkout-release
|
||||
- *download-signed-cli
|
||||
- name: Configure AWS credentials
|
||||
if: needs.plan.outputs.dry_run != 'true'
|
||||
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::604439173067:role/github/opencode-release
|
||||
role-session-name: opencode-${{ github.run_id }}
|
||||
aws-region: us-east-1
|
||||
- name: Read publish secrets
|
||||
if: needs.plan.outputs.dry_run != 'true'
|
||||
uses: aws-actions/aws-secretsmanager-get-secrets@2297f9a879480a9e3af9b293ed15c70caf8e1c88 # v3.0.2
|
||||
with:
|
||||
secret-ids: CLOUDFLARE_API_TOKEN,opencode/release/CLOUDFLARE_API_TOKEN
|
||||
parse-json-secrets: false
|
||||
- name: Publish
|
||||
run: bash .github/release/publish-cli.sh "$RUNNER_TEMP/in/build-archives" "$RUNNER_TEMP/in/sign-macos" "$RUNNER_TEMP/in/sign-windows"
|
||||
env: &cloudflare
|
||||
CLOUDFLARE_ACCOUNT_ID: 15d29c8639fd3733b1b5486a2acfd968
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
|
||||
publish-desktop:
|
||||
needs: [plan, sign-macos, sign-desktop-windows-installer]
|
||||
@@ -628,6 +676,19 @@ jobs:
|
||||
with:
|
||||
pattern: "{sign-macos,sign-desktop-windows-installer,build-desktop-linux-*}"
|
||||
digests: sign-macos=${{ needs.sign-macos.outputs.digest }} sign-desktop-windows-installer=${{ needs.sign-desktop-windows-installer.outputs.digest }}
|
||||
- name: Configure AWS credentials
|
||||
if: needs.plan.outputs.dry_run != 'true'
|
||||
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::604439173067:role/github/opencode-release
|
||||
role-session-name: opencode-${{ github.run_id }}
|
||||
aws-region: us-east-1
|
||||
- name: Read publish secrets
|
||||
if: needs.plan.outputs.dry_run != 'true'
|
||||
uses: aws-actions/aws-secretsmanager-get-secrets@2297f9a879480a9e3af9b293ed15c70caf8e1c88 # v3.0.2
|
||||
with:
|
||||
secret-ids: CLOUDFLARE_API_TOKEN,opencode/release/CLOUDFLARE_API_TOKEN
|
||||
parse-json-secrets: false
|
||||
- name: Publish
|
||||
run: |
|
||||
bash .github/release/publish-desktop.sh "$RUNNER_TEMP/in/sign-macos" "$RUNNER_TEMP/in/sign-desktop-windows-installer" \
|
||||
@@ -666,10 +727,21 @@ jobs:
|
||||
steps:
|
||||
- *checkout-release
|
||||
- *download-signed-cli
|
||||
- name: Configure AWS credentials
|
||||
if: needs.plan.outputs.dry_run != 'true'
|
||||
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::604439173067:role/github/opencode-release
|
||||
role-session-name: opencode-${{ github.run_id }}
|
||||
aws-region: us-east-1
|
||||
- name: Read publish secrets
|
||||
if: needs.plan.outputs.dry_run != 'true'
|
||||
uses: aws-actions/aws-secretsmanager-get-secrets@2297f9a879480a9e3af9b293ed15c70caf8e1c88 # v3.0.2
|
||||
with:
|
||||
secret-ids: HOMEBREW_TAP_DEPLOY_KEY,shared/HOMEBREW_TAP_DEPLOY_KEY
|
||||
parse-json-secrets: false
|
||||
- name: Publish
|
||||
run: bash .github/release/publish-homebrew.sh "$RUNNER_TEMP/in/sign-macos" "$RUNNER_TEMP/in/build-archives"
|
||||
env:
|
||||
HOMEBREW_TAP_DEPLOY_KEY: ${{ secrets.HOMEBREW_TAP_DEPLOY_KEY }}
|
||||
|
||||
# The AUR package installs the published npm tarballs, so it follows the npm publish.
|
||||
publish-aur:
|
||||
@@ -684,10 +756,21 @@ jobs:
|
||||
steps:
|
||||
- *checkout-release
|
||||
- *download-signed-cli
|
||||
- name: Configure AWS credentials
|
||||
if: needs.plan.outputs.dry_run != 'true'
|
||||
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::604439173067:role/github/opencode-release
|
||||
role-session-name: opencode-${{ github.run_id }}
|
||||
aws-region: us-east-1
|
||||
- name: Read publish secrets
|
||||
if: needs.plan.outputs.dry_run != 'true'
|
||||
uses: aws-actions/aws-secretsmanager-get-secrets@2297f9a879480a9e3af9b293ed15c70caf8e1c88 # v3.0.2
|
||||
with:
|
||||
secret-ids: AUR_KEY,shared/AUR_SSH_KEY
|
||||
parse-json-secrets: false
|
||||
- name: Publish
|
||||
run: bash .github/release/publish-aur.sh "$RUNNER_TEMP/in/build-npm"
|
||||
env:
|
||||
AUR_KEY: ${{ secrets.AUR_KEY }}
|
||||
|
||||
# WinGet manifests as data. Submission to microsoft/winget-pkgs stays paused until the packages are accepted.
|
||||
publish-winget:
|
||||
@@ -741,13 +824,26 @@ jobs:
|
||||
environment: ${{ needs.plan.outputs.dry_run != 'true' && 'release' || '' }}
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
env: *env
|
||||
steps:
|
||||
- *checkout-release
|
||||
- name: Configure AWS credentials
|
||||
if: needs.plan.outputs.dry_run != 'true'
|
||||
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
|
||||
with:
|
||||
role-to-assume: arn:aws:iam::604439173067:role/github/opencode-release
|
||||
role-session-name: opencode-${{ github.run_id }}
|
||||
aws-region: us-east-1
|
||||
- name: Read publish secrets
|
||||
if: needs.plan.outputs.dry_run != 'true'
|
||||
uses: aws-actions/aws-secretsmanager-get-secrets@2297f9a879480a9e3af9b293ed15c70caf8e1c88 # v3.0.2
|
||||
with:
|
||||
secret-ids: DISCORD_WEBHOOK,opencode/release/DISCORD_WEBHOOK
|
||||
parse-json-secrets: false
|
||||
- name: Publish
|
||||
run: bash .github/release/publish-discord.sh
|
||||
env:
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
OPENCODE_RELEASE_NOTES: ${{ inputs.release_notes }}
|
||||
|
||||
# Brings the release commit back to dev. Pushing to dev is blocked by rulesets, so it opens a PR.
|
||||
|
||||
Reference in New Issue
Block a user