Use versioned Worker previews for branch content
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
name: Deploy blog static Worker preview
|
||||
name: Upload blog Worker preview version
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -19,7 +19,7 @@ on:
|
||||
|
||||
jobs:
|
||||
preview:
|
||||
name: Preview blog
|
||||
name: Preview blog version
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -39,8 +39,12 @@ jobs:
|
||||
run: npm run build:site
|
||||
- name: Verify selected output
|
||||
run: npm run verify:build
|
||||
- name: Deploy non-production Worker
|
||||
run: npx wrangler deploy --config wrangler/blog.jsonc
|
||||
- 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 }}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Deploy primary static Worker preview
|
||||
name: Upload primary Worker preview version
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -19,7 +19,7 @@ on:
|
||||
|
||||
jobs:
|
||||
preview:
|
||||
name: Preview www
|
||||
name: Preview www version
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -39,8 +39,12 @@ jobs:
|
||||
run: npm run build:site
|
||||
- name: Verify selected output
|
||||
run: npm run verify:build
|
||||
- name: Deploy non-production Worker
|
||||
run: npx wrangler deploy --config "wrangler/${SITE_KEY}.jsonc"
|
||||
- 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_API_TOKEN }}
|
||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
|
||||
|
||||
Reference in New Issue
Block a user