Files
edgeever/.github/workflows/deploy-demo.yml
T

69 lines
2.5 KiB
YAML

name: Deploy Demo
on:
release:
types:
- published
workflow_dispatch:
permissions:
contents: read
concurrency:
group: edgeever-demo-deployment
cancel-in-progress: false
jobs:
deploy:
# This is the maintainer's Demo deployment, not a default self-hosted
# deployment workflow. Forks and downstream repositories must configure
# their own deployment pipeline and credentials.
if: github.repository == 'tianma-if/edgeever'
name: Build and deploy Demo Worker
runs-on: ubuntu-latest
timeout-minutes: 20
env:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
EDGE_EVER_WORKER_NAME: ${{ secrets.EDGE_EVER_DEMO_WORKER_NAME }}
EDGE_EVER_D1_DATABASE_NAME: ${{ secrets.EDGE_EVER_DEMO_D1_DATABASE_NAME }}
EDGE_EVER_D1_DATABASE_ID: ${{ secrets.EDGE_EVER_DEMO_D1_DATABASE_ID }}
EDGE_EVER_R2_BUCKET_NAME: ${{ secrets.EDGE_EVER_DEMO_R2_BUCKET_NAME }}
EDGE_EVER_R2_PREVIEW_BUCKET_NAME: ${{ secrets.EDGE_EVER_DEMO_R2_PREVIEW_BUCKET_NAME }}
EDGE_EVER_AUTH_USERNAME: ${{ secrets.EDGE_EVER_DEMO_AUTH_USERNAME }}
EDGE_EVER_SESSION_TTL_DAYS: ${{ secrets.EDGE_EVER_DEMO_SESSION_TTL_DAYS }}
EDGE_EVER_DEMO_MODE: "true"
EDGE_EVER_DEMO_RESET_CRON: "0 19 * * *"
DEMO_DEPLOY_DOMAIN: ${{ secrets.EDGE_EVER_DEMO_CUSTOM_DOMAIN }}
EDGE_EVER_DEPLOYMENT_TRIGGER: ${{ github.event_name == 'release' && 'github_release' || 'manual' }}
EDGE_EVER_DEPLOYMENT_METHOD: "github_actions"
steps:
- name: Checkout Demo source
uses: actions/checkout@v5
with:
ref: ${{ github.event.release.tag_name || github.ref }}
- name: Set up Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Resolve Release metadata
env:
GH_TOKEN: ${{ github.token }}
RELEASE_PUBLISHED_AT: ${{ github.event.release.published_at || '' }}
run: |
if [ -z "${RELEASE_PUBLISHED_AT}" ]; then
RELEASE_PUBLISHED_AT="$(gh api repos/tianma-if/edgeever/releases/latest --jq '.published_at')"
fi
echo "EDGE_EVER_RELEASED_AT=${RELEASE_PUBLISHED_AT}" >> "${GITHUB_ENV}"
- name: Deploy Demo Worker
run: bun run deploy
- name: Verify Demo URL
if: env.DEMO_DEPLOY_DOMAIN != ''
run: curl --fail --silent --show-error --location --max-time 20 "https://${DEMO_DEPLOY_DOMAIN}/"