Repository navigation
69 lines (61 loc) · 2.77 KB
/
Copy pathdeploy-website.yml
File metadata and controls
69 lines (61 loc) · 2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Deploy Website
# The marketing site deploys when a nostream-website release is published:
# the changesets release PR bumps the site package, and merging that PR makes
# the changesets workflow tag + publish nostream-website@X.Y.Z and create the
# GitHub release — this workflow deploys that tagged build. Merges to main do
# not deploy; version the site with a changeset and merge the release PR.
on:
release:
types:
- published
workflow_dispatch:
jobs:
deploy:
# Concurrency lives on the job, not the workflow: a relay release
# (v* tag) fails the if below and must not enter this deploy queue,
# where it could replace a queued website deploy. Measured: the
# nostream@3.5.1 release run (38845857055) was cancelled with zero
# jobs at the workflow-level group, before the job if could skip it.
concurrency:
group: deploy-website
cancel-in-progress: false
# workflow_dispatch ignores every on: filter — a manual run must not
# publish a non-main branch to production, so dispatch stays main-only.
if: >-
${{ startsWith(github.event.release.tag_name, 'nostream-website@') ||
(github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main') }}
name: Build and deploy to Cloudflare Workers
runs-on: ubuntu-latest
# Deploy credentials live in this GitHub environment: CLOUDFLARE_API_TOKEN
# secret (Workers Scripts scope) and CLOUDFLARE_ACCOUNT_ID variable.
environment: website
permissions:
contents: read
steps:
# Checkout gets the release event's default: the tag that triggered the
# run (refs/tags/nostream-website@X.Y.Z). The website environment's
# branch policy admits nostream-website@* — every release deploy since
# 1.1.1 has run on the tag ref — so the build is exactly the released
# commit, even if main has advanced by the time the job starts.
- name: Checkout
uses: actions/checkout@v3
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: pnpm
- name: Install workspace dependencies
run: pnpm install --frozen-lockfile
- name: Build the site
working-directory: website/site
env:
SITE_URL: https://ema.tnsor.network
run: pnpm run build
- name: Deploy to Cloudflare Workers
working-directory: website/site
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
# The router worker: serves the production assets itself and proxies
# /preview/<n> to per-PR preview workers (deploy-website-preview.yml).
run: pnpm exec wrangler deploy --config wrangler.router.jsonc