mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-17 08:05:19 +00:00
72 lines
3.0 KiB
YAML
72 lines
3.0 KiB
YAML
name: 'Deploy cloudflare'
|
|
description: 'Deploy GitBook to Cloudflare'
|
|
inputs:
|
|
opItem:
|
|
description: '1Password item to load secrets from'
|
|
required: true
|
|
opServiceAccount:
|
|
description: '1Password service account token'
|
|
required: true
|
|
apiToken:
|
|
description: 'Cloudflare API token'
|
|
required: true
|
|
accountId:
|
|
description: 'Cloudflare account ID'
|
|
required: true
|
|
environment:
|
|
description: 'Cloudflare environment to deploy to (staging, production, preview)'
|
|
required: true
|
|
deploy:
|
|
description: 'Deploy as main version for all traffic instead of uploading versions'
|
|
required: true
|
|
outputs:
|
|
deployment-url:
|
|
description: "Deployment URL"
|
|
value: ${{ steps.deploy.outputs.deployment-url }}
|
|
runs:
|
|
using: 'composite'
|
|
steps:
|
|
- name: Setup Bun
|
|
uses: ./.github/composite/setup-bun
|
|
- name: Install dependencies
|
|
run: bun install --frozen-lockfile
|
|
shell: bash
|
|
env:
|
|
PUPPETEER_SKIP_DOWNLOAD: 1
|
|
- name: Load secret
|
|
uses: 1password/load-secrets-action@v2
|
|
env:
|
|
OP_SERVICE_ACCOUNT_TOKEN: ${{ inputs.opServiceAccount }}
|
|
GITBOOK_URL: ${{ inputs.opItem }}/GITBOOK_URL
|
|
GITBOOK_ICONS_URL: ${{ inputs.opItem }}/GITBOOK_ICONS_URL
|
|
GITBOOK_ICONS_TOKEN: ${{ inputs.opItem }}/GITBOOK_ICONS_TOKEN
|
|
NEXT_SERVER_ACTIONS_ENCRYPTION_KEY: ${{ inputs.opItem }}/NEXT_SERVER_ACTIONS_ENCRYPTION_KEY
|
|
GITBOOK_SECRET: ${{ inputs.opItem }}/GITBOOK_SECRET
|
|
GITBOOK_APP_URL: ${{ inputs.opItem }}/GITBOOK_APP_URL
|
|
GITBOOK_API_URL: ${{ inputs.opItem }}/GITBOOK_API_URL
|
|
GITBOOK_API_PUBLIC_URL: ${{ inputs.opItem }}/GITBOOK_API_PUBLIC_URL
|
|
GITBOOK_API_TOKEN: ${{ inputs.opItem }}/GITBOOK_API_TOKEN
|
|
GITBOOK_INTEGRATIONS_HOST: ${{ inputs.opItem }}/GITBOOK_INTEGRATIONS_HOST
|
|
GITBOOK_IMAGE_RESIZE_SIGNING_KEY: ${{ inputs.opItem }}/GITBOOK_IMAGE_RESIZE_SIGNING_KEY
|
|
GITBOOK_IMAGE_RESIZE_URL: ${{ inputs.opItem }}/GITBOOK_IMAGE_RESIZE_URL
|
|
GITBOOK_ASSETS_PREFIX: ${{ inputs.opItem }}/GITBOOK_ASSETS_PREFIX
|
|
GITBOOK_FONTS_URL: ${{ inputs.opItem }}/GITBOOK_FONTS_URL
|
|
- name: Build worker
|
|
run: bun run turbo build:v2:cloudflare
|
|
shell: bash
|
|
- id: deploy
|
|
name: Deploy to Cloudflare
|
|
uses: cloudflare/wrangler-action@v3.14.0
|
|
with:
|
|
apiToken: ${{ inputs.apiToken }}
|
|
accountId: ${{ inputs.accountId }}
|
|
workingDirectory: ./
|
|
wranglerVersion: '3.112.0'
|
|
environment: ${{ inputs.environment }}
|
|
command: ${{ fromJSON(inputs.deploy) == true && 'deploy' || 'versions upload' }} --config ./packages/gitbook-v2/wrangler.toml
|
|
- name: Outputs
|
|
shell: bash
|
|
env:
|
|
DEPLOYMENT_URL: ${{ steps.deploy.outputs.deployment-url }}
|
|
run: |
|
|
echo "URL: ${{ steps.deploy.outputs.deployment-url }}" |