mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-29 11:42:17 +00:00
53 lines
1.7 KiB
YAML
53 lines
1.7 KiB
YAML
name: deploy-site
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- dev
|
|
- production
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: deploy-site-${{ github.ref_name }}
|
|
cancel-in-progress: false
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
deploy:
|
|
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
|
|
|
|
- uses: ./.github/actions/setup-bun
|
|
|
|
# The workflow's own token, at build time only: script/github-snapshot.ts records the repo
|
|
# numbers and releases the site falls back to. The Worker never gets a GitHub token.
|
|
- name: Build
|
|
working-directory: services/site
|
|
run: bun script/build.ts --mode ${{ github.ref_name }}
|
|
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 }}
|