51 lines
1.5 KiB
YAML
51 lines
1.5 KiB
YAML
name: Upload blog Worker preview version
|
|
|
|
on:
|
|
push:
|
|
branches-ignore: [main]
|
|
paths:
|
|
- .gitea/workflows/deploy-blog.yml
|
|
- astro.config.mjs
|
|
- package.json
|
|
- package-lock.json
|
|
- public/**
|
|
- schemas/**
|
|
- scripts/**
|
|
- sites.json
|
|
- sites/blog/**
|
|
- src/**
|
|
- wrangler/blog.jsonc
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
preview:
|
|
name: Preview blog version
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
env:
|
|
SITE_KEY: blog
|
|
ASTRO_TELEMETRY_DISABLED: '1'
|
|
steps:
|
|
- name: Checkout source
|
|
uses: https://github.com/actions/checkout@v4
|
|
- name: Use Node 22
|
|
uses: https://github.com/actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
- name: Install locked dependencies
|
|
run: npm ci
|
|
- name: Validate and build selected site
|
|
run: npm run build:site
|
|
- name: Verify selected output
|
|
run: npm run verify:build
|
|
- 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/blog.production.jsonc --preview-alias "$preview_alias"
|
|
env:
|
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
|
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
|