Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .github/workflows/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ name: Site
# Checks that the website in site/ builds. It reads the Project file reference
# from docs/, the screenshots from .github/assets/ and the colours from the
# desktop app's tokens, so changes there are checked too. Publishing is done by
# the host serving the custom domain, which builds site/ itself.
# Vercel, which builds site/ itself on every push to main. The download links
# are read from the latest release at build time, so publishing a release asks
# Vercel for a fresh build through its deploy hook.
on:
release:
types: [published]
push:
branches: [main]
paths: [site/**, docs/**, .github/assets/**, apps/desktop/src/styles/tokens.css, .github/workflows/site.yml]
Expand Down Expand Up @@ -39,3 +43,18 @@ jobs:
- run: pnpm build
env:
GITHUB_TOKEN: ${{ github.token }}

deploy:
name: Rebuild the site for the new release
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- name: Call Vercel's deploy hook
env:
VERCEL_DEPLOY_HOOK: ${{ secrets.VERCEL_DEPLOY_HOOK }}
run: |
if [[ -z $VERCEL_DEPLOY_HOOK ]]; then
echo "::warning::No VERCEL_DEPLOY_HOOK secret: the site keeps the previous release's download links until the next push to main."
exit 0
fi
curl --fail --silent --show-error --retry 3 -X POST "$VERCEL_DEPLOY_HOOK"
8 changes: 4 additions & 4 deletions site/src/lib/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ const patterns = {

let cached: Promise<Release> | undefined;

/** The latest published release, read from GitHub once per build. The site
* is rebuilt when a release is published (.github/workflows/site.yml), so the
* links always name that release's files. Without one, or without network,
* every link goes to the Releases page. */
/** The latest published release, read from GitHub once per build. Publishing
* a release rebuilds the site through Vercel's deploy hook
* (.github/workflows/site.yml), so the links name that release's files.
* Without one, or without network, every link goes to the Releases page. */
export function latestRelease(): Promise<Release> {
cached ??= load();
return cached;
Expand Down
Loading