Skip to content

feat(appearance): customizable login and home backgrounds #244

feat(appearance): customizable login and home backgrounds

feat(appearance): customizable login and home backgrounds #244

name: Deploy PR Preview
on:
pull_request:
types: [labeled, synchronize]
permissions:
contents: read
pull-requests: write
concurrency:
group: deploy-pr-preview-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
deploy:
name: Deploy PR #${{ github.event.pull_request.number }} Preview
if: contains(github.event.pull_request.labels.*.name, 'deploy:preview:frontend')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- name: Setup Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version-file: package.json
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
node-version: "24"
- name: Cache Bun dependencies
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Write frontend-only preview environment
working-directory: frontend
run: |
# Frontend-only preview: no backend is provisioned. An empty apiUrl
# keeps the app in local/offline mode; users can point at an existing
# server at runtime through the setup flow.
printf 'export const environment = {\n production: true,\n version: "0.1.0",\n apiUrl: "",\n wssUrl: "",\n};\n' > src/environments/environment.preview.ts
- name: Inject TWA signing fingerprint
working-directory: frontend
env:
TWA_SHA256_FINGERPRINT: ${{ vars.TWA_SHA256_FINGERPRINT }}
run: |
sed -i "s|__TWA_SHA256_FINGERPRINT__|${TWA_SHA256_FINGERPRINT}|g" public/.well-known/assetlinks.json
- name: Build frontend
working-directory: frontend
run: bun run clean && bun run ng build --configuration=preview && git rev-parse --short HEAD > dist/browser/assets/version.txt && bun run compress-wasm
- name: Deploy frontend to Cloudflare Pages
uses: cloudflare/wrangler-action@ebbaa1584979971c8614a24965b4405ff95890e0 # v4
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy frontend/dist/browser --project-name=${{ vars.PAGES_PROJECT || 'inkweld-frontend-preview' }} --branch=pr-${{ github.event.pull_request.number }}
- name: Comment deploy URL on PR
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
env:
PAGES_PROJECT: ${{ vars.PAGES_PROJECT || 'inkweld-frontend-preview' }}
PR_NUMBER: ${{ github.event.pull_request.number }}
with:
script: |
const project = process.env.PAGES_PROJECT;
const pr = process.env.PR_NUMBER;
const url = `https://pr-${pr}.${project}.pages.dev`;
const body =
`🚀 **Frontend preview deployed for #${pr}**\n\n` +
`- **Preview:** ${url}\n\n` +
`This is a frontend-only preview (no backend). It runs in local/offline mode; ` +
`point it at an existing server at runtime through the setup flow if needed. ` +
`On PR close or label removal, the cleanup workflow attempts to delete this branch's ` +
`Pages deployments; note that Cloudflare keeps the latest deployment for a branch, so ` +
`the preview URL may remain reachable after cleanup.`;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr,
body,
});