-
Notifications
You must be signed in to change notification settings - Fork 17
105 lines (88 loc) · 2.84 KB
/
Copy pathpages.yml
File metadata and controls
105 lines (88 loc) · 2.84 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Build and deploy site
# Builds and verifies every pull request. Pushes to master are additionally
# deployed to GitHub Pages. PR builds are retained as downloadable preview
# artifacts so proposed changes can be tested locally before merging.
#
# Requires repo Settings -> Pages -> "Build and deployment" -> Source = "GitHub Actions".
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: pages-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
build:
runs-on: ubuntu-latest
env:
JEKYLL_ENV: production
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
bundler-cache: true
- name: Set up Node
uses: actions/setup-node@v6
with:
node-version: "24"
- name: Install frontend dependencies
run: npm ci
- name: Verify vendored frontend assets
run: |
npm run vendor:frontend
git diff --exit-code -- assets/plugins
- name: Build site
run: bundle exec jekyll build
- name: Verify built dependency assets
run: npm test
- name: Generate Pagefind search index
run: npx -y pagefind@1.5.2 --site _site
- name: Verify search index exists
run: test -f _site/pagefind/pagefind.js && test -f _site/pagefind/pagefind-entry.json
- name: Upload Pages artifact
if: github.event_name != 'pull_request'
uses: actions/upload-pages-artifact@v4
with:
path: _site
- name: Upload PR preview
if: github.event_name == 'pull_request'
id: preview
uses: actions/upload-artifact@v7
with:
name: site-preview-pr-${{ github.event.pull_request.number }}
path: _site
retention-days: 7
- name: Add PR preview instructions
if: github.event_name == 'pull_request'
run: |
{
echo "### Site preview"
echo
echo "Download [site-preview-pr-${{ github.event.pull_request.number }}](${{ steps.preview.outputs.artifact-url }}), extract it, then serve the directory locally:"
echo
echo '```shell'
echo 'python -m http.server 4000'
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
deploy:
if: github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4