Bound Cloudflare preview aliases
This commit is contained in:
@@ -48,8 +48,9 @@ jobs:
|
||||
- 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}"
|
||||
preview_slug="$(printf '%s' "$raw_ref" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9-]+/-/g; s/^-+//; s/-+$//')"
|
||||
preview_hash="$(printf '%s' "$raw_ref" | sha256sum | cut -c1-8)"
|
||||
preview_alias="$(printf '%s' "${preview_slug:-preview}" | cut -c1-20)-$preview_hash"
|
||||
npx wrangler versions upload --config wrangler/blog.production.jsonc --preview-alias "$preview_alias"
|
||||
env:
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
|
||||
|
||||
@@ -48,8 +48,9 @@ jobs:
|
||||
- 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}"
|
||||
preview_slug="$(printf '%s' "$raw_ref" | tr '[:upper:]' '[:lower:]' | sed -E 's/[^a-z0-9-]+/-/g; s/^-+//; s/-+$//')"
|
||||
preview_hash="$(printf '%s' "$raw_ref" | sha256sum | cut -c1-8)"
|
||||
preview_alias="$(printf '%s' "${preview_slug:-preview}" | cut -c1-20)-$preview_hash"
|
||||
npx wrangler versions upload --config wrangler/www.production.jsonc --preview-alias "$preview_alias"
|
||||
env:
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
|
||||
|
||||
Reference in New Issue
Block a user