hex/.github/workflows/site.yml

50 lines
1.4 KiB
YAML

name: Site
# Builds hex.kitlangton.com and checks every download link it shows. On main it
# deploys the Cloudflare Worker when the repository has a CLOUDFLARE_API_TOKEN
# secret (Workers Scripts: Edit on the personal account); without one, deploy
# from a Mac with `cd site && bun run build && bunx wrangler deploy`.
on:
pull_request:
paths:
- "site/**"
- ".github/workflows/site.yml"
push:
branches: [main]
paths:
- "site/**"
- ".github/workflows/site.yml"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: site-${{ github.ref }}
cancel-in-progress: true
jobs:
site:
runs-on: ubuntu-latest
defaults:
run:
working-directory: site
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- run: bun run build
- name: Check every download link
run: bun run check:downloads
- name: Deploy
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
run: |
if [ -z "$CLOUDFLARE_API_TOKEN" ]; then
echo "::notice::No CLOUDFLARE_API_TOKEN secret; deploy hex.kitlangton.com from a Mac."
exit 0
fi
bunx wrangler@4 deploy