Files
Sable/.github/workflows/cloudflare-web-preview.yml
dependabot[bot] 3ae837d755 chore: bump the github-actions group across 1 directory with 15 updates
Bumps the github-actions group with 15 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [cloudflare/wrangler-action](https://github.com/cloudflare/wrangler-action) | `4.0.0` | `4.1.3` |
| [dflook/tofu-plan](https://github.com/dflook/tofu-plan) | `3.0.0` | `3.1.2` |
| [github/codeql-action/init](https://github.com/github/codeql-action) | `4.37.9` | `4.39.1` |
| [github/codeql-action/analyze](https://github.com/github/codeql-action) | `4.37.9` | `4.39.1` |
| [docker/login-action](https://github.com/docker/login-action) | `4.6.0` | `4.7.0` |
| [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) | `4.3.0` | `4.4.0` |
| [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) | `4.3.0` | `4.4.1` |
| [docker/build-push-action](https://github.com/docker/build-push-action) | `7.3.0` | `7.4.0` |
| [actions/upload-artifact](https://github.com/actions/upload-artifact) | `7.0.1` | `7.0.2` |
| [actions/create-github-app-token](https://github.com/actions/create-github-app-token) | `3.2.0` | `3.3.0` |
| [DeterminateSystems/determinate-nix-action](https://github.com/determinatesystems/determinate-nix-action) | `3.22.2` | `3.24.0` |
| [Swatinem/rust-cache](https://github.com/swatinem/rust-cache) | `2.9.2` | `2.9.3` |
| [gradle/actions/setup-gradle](https://github.com/gradle/actions) | `6.3.0` | `6.4.0` |
| [jdx/mise-action](https://github.com/jdx/mise-action) | `4.3.0` | `5.2.2` |
| [actions/download-artifact](https://github.com/actions/download-artifact) | `8.0.1` | `8.0.2` |



Updates `cloudflare/wrangler-action` from 4.0.0 to 4.1.3
- [Release notes](https://github.com/cloudflare/wrangler-action/releases)
- [Changelog](https://github.com/cloudflare/wrangler-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/cloudflare/wrangler-action/compare/ebbaa1584979971c8614a24965b4405ff95890e0...953926a2e2182532811c01a25e53647d93bf07c0)

Updates `dflook/tofu-plan` from 3.0.0 to 3.1.2
- [Release notes](https://github.com/dflook/tofu-plan/releases)
- [Commits](https://github.com/dflook/tofu-plan/compare/cdb4f4d604c9fa695e457744dd1f802853397ce7...53b5b01b6eef56cd678401dbe92a0f6ca6b863ff)

Updates `github/codeql-action/init` from 4.37.9 to 4.39.1
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/cdf488f595d80d6e07e03d4674febd5ab45fa938...9b3254085494b55a0f7c4c2b3d2d52cc712ce370)

Updates `github/codeql-action/analyze` from 4.37.9 to 4.39.1
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/cdf488f595d80d6e07e03d4674febd5ab45fa938...9b3254085494b55a0f7c4c2b3d2d52cc712ce370)

Updates `docker/login-action` from 4.6.0 to 4.7.0
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/dbcb813823bdd20940b903addbd779551569679f...81c6f93d4bc991e510b342a00b419b3bb4efc5c6)

Updates `docker/setup-qemu-action` from 4.3.0 to 4.4.0
- [Release notes](https://github.com/docker/setup-qemu-action/releases)
- [Commits](https://github.com/docker/setup-qemu-action/compare/1f40c72289eff860ee54a304f1438e3cff362e0a...99012661954931238ded8c8b007157a8430204e1)

Updates `docker/setup-buildx-action` from 4.3.0 to 4.4.1
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/37fe631027851001ddb9b187196cc803df7f5f0e...f87e5991a6d7451dcb8d9637bfbc97413f497069)

Updates `docker/build-push-action` from 7.3.0 to 7.4.0
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/53b7df96c91f9c12dcc8a07bcb9ccacbed38856a...c3c9e263c25d99ce0380d002d59b67737d91b0dc)

Updates `actions/upload-artifact` from 7.0.1 to 7.0.2
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/043fb46d1a93c77aae656e7c1c64a875d1fc6a0a...cf430e030ddbb5b0abf93d22962f4752f3646cd9)

Updates `actions/create-github-app-token` from 3.2.0 to 3.3.0
- [Release notes](https://github.com/actions/create-github-app-token/releases)
- [Changelog](https://github.com/actions/create-github-app-token/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/create-github-app-token/compare/bcd2ba49218906704ab6c1aa796996da409d3eb1...64ab729a6294000f5aa4a4bc0b73d1f32bc45510)

Updates `DeterminateSystems/determinate-nix-action` from 3.22.2 to 3.24.0
- [Release notes](https://github.com/determinatesystems/determinate-nix-action/releases)
- [Commits](https://github.com/determinatesystems/determinate-nix-action/compare/527f17dd63d2d60d3e5552934bc84b9a33a14d11...f296148a827001a9a82d3685b53210c06e5d3b67)

Updates `Swatinem/rust-cache` from 2.9.2 to 2.9.3
- [Release notes](https://github.com/swatinem/rust-cache/releases)
- [Changelog](https://github.com/Swatinem/rust-cache/blob/master/CHANGELOG.md)
- [Commits](https://github.com/swatinem/rust-cache/compare/6323deb102c322ba6fcbdcafc7e3dddab59af2b6...d1527c8f67ef9af357290475d4af4b0fab8f12e0)

Updates `gradle/actions/setup-gradle` from 6.3.0 to 6.4.0
- [Release notes](https://github.com/gradle/actions/releases)
- [Commits](https://github.com/gradle/actions/compare/9c971963bec38e04b3d30dcc455b5382be2fdbfb...3f5f9adaf7d9fecd50b5935e54106014257a94e6)

Updates `jdx/mise-action` from 4.3.0 to 5.2.2
- [Release notes](https://github.com/jdx/mise-action/releases)
- [Changelog](https://github.com/jdx/mise-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jdx/mise-action/compare/c2a87611a18de5b3828c5652fe268e992400cb5c...8418fedb1110381a0d3ba51a7a415d7c1b884550)

Updates `actions/download-artifact` from 8.0.1 to 8.0.2
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c...9000827ccba6bdab643e8b6fd33ac0654aef8333)

---
updated-dependencies:
- dependency-name: cloudflare/wrangler-action
  dependency-version: 4.1.3
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: dflook/tofu-plan
  dependency-version: 3.1.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: github/codeql-action/init
  dependency-version: 4.39.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: github/codeql-action/analyze
  dependency-version: 4.39.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: docker/login-action
  dependency-version: 4.7.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: docker/setup-qemu-action
  dependency-version: 4.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: docker/setup-buildx-action
  dependency-version: 4.4.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: docker/build-push-action
  dependency-version: 7.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: actions/upload-artifact
  dependency-version: 7.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: actions/create-github-app-token
  dependency-version: 3.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: DeterminateSystems/determinate-nix-action
  dependency-version: 3.24.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: Swatinem/rust-cache
  dependency-version: 2.9.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: gradle/actions/setup-gradle
  dependency-version: 6.4.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: jdx/mise-action
  dependency-version: 5.2.2
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: actions/download-artifact
  dependency-version: 8.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <[email protected]>
2026-10-30 01:29:12 +00:00

177 lines
6.6 KiB
YAML

name: Cloudflare Worker Preview Deploy
on:
pull_request:
paths:
- 'src/**'
- 'index.html'
- 'package.json'
- 'package-lock.json'
- 'vite.config.ts'
- 'tsconfig.json'
- '.github/workflows/cloudflare-web-preview.yml'
- '.github/actions/setup/**'
push:
branches:
- dev
paths:
- 'src/**'
- 'index.html'
- 'package.json'
- 'package-lock.json'
- 'vite.config.ts'
- 'tsconfig.json'
- '.github/workflows/cloudflare-web-preview.yml'
- '.github/actions/setup/**'
concurrency:
group: cloudflare-worker-preview-${{ github.event.pull_request.number || github.ref_name }}
cancel-in-progress: true
jobs:
deploy:
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.head_ref != 'release') || github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Prepare preview metadata
id: metadata
shell: bash
run: |
preview_message="$(git log -1 --pretty=%s)"
preview_message="$(printf '%s' "$preview_message" | head -c 100)"
{
echo 'preview_message<<EOF'
echo "$preview_message"
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Set Sentry build environment for PR preview
if: github.event_name == 'pull_request'
env:
VITE_SENTRY_DSN: ${{ secrets.VITE_SENTRY_DSN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
shell: bash
run: |
echo "VITE_SENTRY_DSN=$VITE_SENTRY_DSN" >> "$GITHUB_ENV"
echo "VITE_SENTRY_ENVIRONMENT=preview" >> "$GITHUB_ENV"
echo "VITE_SENTRY_PR=${{ github.event.pull_request.number }}" >> "$GITHUB_ENV"
echo "SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN" >> "$GITHUB_ENV"
echo "SENTRY_ORG=$SENTRY_ORG" >> "$GITHUB_ENV"
echo "SENTRY_PROJECT=$SENTRY_PROJECT" >> "$GITHUB_ENV"
- name: Setup app and build
uses: ./.github/actions/setup
with:
build: 'true'
- name: Set deploy alias
id: alias
shell: bash
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "alias=pr-${{ github.event.pull_request.number }}" >> "$GITHUB_OUTPUT"
else
branch="${GITHUB_REF_NAME}"
alias="$(echo "$branch" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/-\+/-/g' | sed 's/^-\|-$//g')"
echo "alias=${alias}" >> "$GITHUB_OUTPUT"
fi
- name: Upload Worker preview
id: deploy
uses: cloudflare/wrangler-action@953926a2e2182532811c01a25e53647d93bf07c0 # v4.1.3
env:
PREVIEW_MESSAGE: ${{ steps.metadata.outputs.preview_message }}
with:
apiToken: ${{ secrets.TF_CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.TF_VAR_ACCOUNT_ID }}
command: >
versions upload
-c dist/wrangler.json
--preview-alias ${{ steps.alias.outputs.alias }}
--message "$PREVIEW_MESSAGE"
- name: Resolve preview URL
id: preview
env:
DEPLOYMENT_URL: ${{ steps.deploy.outputs.deployment-url }}
COMMAND_OUTPUT: ${{ steps.deploy.outputs.command-output }}
ALIAS: ${{ steps.alias.outputs.alias }}
shell: bash
run: |
alias_url_pattern="^https?://${ALIAS}-[^[:space:]]+$"
preview_url=""
if printf '%s\n' "$DEPLOYMENT_URL" | grep -Eq "$alias_url_pattern"; then
preview_url="$DEPLOYMENT_URL"
else
preview_url="$(printf '%s\n' "$COMMAND_OUTPUT" | grep -Eo "https?://${ALIAS}-[^[:space:]\"'<>)]+" | head -n 1 || true)"
fi
if ! printf '%s\n' "$preview_url" | grep -Eq "$alias_url_pattern"; then
echo "Failed to resolve aliased Worker preview URL." >&2
exit 1
fi
echo "preview_url=${preview_url}" >> "$GITHUB_OUTPUT"
- name: Publish summary and PR comment
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
MARKER: '<!-- cloudflare-worker-preview -->'
PREVIEW_URL: ${{ steps.preview.outputs.preview_url }}
PREVIEW_ALIAS: ${{ steps.alias.outputs.alias }}
SHORT_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const marker = process.env.MARKER;
const previewUrl = process.env.PREVIEW_URL;
const previewAlias = process.env.PREVIEW_ALIAS;
const shortSha = process.env.SHORT_SHA?.slice(0, 7);
const now = new Date().toUTCString().replace(':00 GMT', ' UTC');
if (!previewUrl) {
core.setFailed("Missing preview URL from Cloudflare deploy step.");
return;
}
const tableRow = "| ✅ Deployment successful! | <a href='" + previewUrl + "'>" + previewUrl + "</a> | " + shortSha + " | `" + previewAlias + "` | " + now + " |";
const comment = [
marker,
`## Deploying with &nbsp;<a href="https://workers.dev"><img alt="Cloudflare Workers" src="https://workers.cloudflare.com/logo.svg" width="16"></a> &nbsp;Cloudflare Workers`,
``,
`| Status | Preview URL | Commit | Alias | Updated (UTC) |`,
`| - | - | - | - | - |`,
tableRow,
].join("\n");
await core.summary.addRaw(comment.replace(marker + "\n", "")).write();
if (context.eventName !== 'pull_request') return;
const { owner, repo } = context.repo;
const issue_number = context.issue.number;
const comments = await github.paginate(github.rest.issues.listComments, {
owner, repo, issue_number,
});
const existing = comments.find(
(c) => c.user.type === "Bot" && c.body.includes(marker),
);
if (existing) {
await github.rest.issues.deleteComment({
owner, repo, comment_id: existing.id,
});
}
await github.rest.issues.createComment({ owner, repo, issue_number, body: comment });