Files
3031023-xyz-public/.gitea/workflows/deploy.yml
T

57 lines
1.9 KiB
YAML

name: Upload primary Worker preview version
on:
push:
branches-ignore: [main]
paths:
- .gitea/workflows/deploy.yml
- astro.config.mjs
- package.json
- package-lock.json
- public/**
- schemas/**
- scripts/**
- sites.json
- sites/www/**
- src/**
- wrangler/www.jsonc
workflow_dispatch:
jobs:
preview:
name: Preview www version
runs-on: ubuntu-latest
permissions:
contents: read
env:
SITE_KEY: www
ASTRO_TELEMETRY_DISABLED: '1'
steps:
- name: Checkout source
uses: https://github.com/actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: Use Node 22
uses: https://github.com/actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 22
cache: npm
cache-dependency-path: package-lock.json
- name: Install locked dependencies
run: npm ci --prefer-offline --no-audit --no-fund
- name: Validate and build selected site
run: npm run build:site
- name: Verify selected output
run: npm run verify:build
- name: Verify SloanOps account target
env:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_MIGRATION_ACCOUNT_ID }}
run: test "$CLOUDFLARE_ACCOUNT_ID" = "9894ee8f9432da1018e0f3861d86dedb"
- name: Upload non-production preview version
run: |
raw_ref="${GITHUB_REF_NAME:-${GITEA_REF_NAME:-preview}}"
preview_alias="$(printf '%s' "$raw_ref" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9-]+/-/g; s/^-+//; s/-+$//' | cut -c1-40)"
preview_alias="${preview_alias:-preview}"
npx wrangler versions upload --config wrangler/www.production.jsonc --preview-alias "$preview_alias"
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_MIGRATION_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_MIGRATION_ACCOUNT_ID }}