-
Notifications
You must be signed in to change notification settings - Fork 15
61 lines (54 loc) · 2.18 KB
/
Copy pathdeploy-site.yml
File metadata and controls
61 lines (54 loc) · 2.18 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
name: Deploy site
# Issue: this used to trigger only on `release: published`. But build.yml
# creates the GitHub Release using `secrets.GITHUB_TOKEN` (via
# softprops/action-gh-release) — and GitHub's anti-recursion rule means
# events produced *by* GITHUB_TOKEN never trigger other workflows in the
# same repo. So `release: published` has silently never fired for a single
# beta release; the June 25 ref-pinning fix corrected *what* would be
# deployed if this ran, but not *whether* it ran at all. Triggering on the
# tag push itself fixes that: `git push origin vX.Y.Z` is a normal,
# non-GITHUB_TOKEN push, so it fires like any other push event.
# `release: published` is kept as a secondary trigger for the rare case of
# manually editing/republishing a release by hand via the GitHub UI.
on:
push:
branches: [main]
tags:
- "v*"
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
deploy:
name: "Deploy to GitHub Pages"
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
# On a `release` event, checkout defaults to whatever's on the default
# branch (main) — NOT the tag that was actually released. That silently
# turned this into a no-op for every beta release, since main's site/
# only gets updated by an explicit manual sync. Pin the ref explicitly:
# release events deploy site/ exactly as it existed at the released
# tag (which lives on `beta` for betas), so the site always tracks
# whatever was just shipped without a manual sync step ever again.
# Plain pushes to main and manual workflow_dispatch runs keep their
# normal ref (github.ref) unaffected.
- uses: actions/checkout@v7
with:
ref: ${{ github.event_name == 'release' && github.event.release.tag_name || github.ref }}
- uses: actions/configure-pages@v6
- uses: actions/upload-pages-artifact@v5
with:
path: site/
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5