-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (118 loc) · 4.9 KB
/
Copy pathwebsite.yml
File metadata and controls
138 lines (118 loc) · 4.9 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# SPDX-FileCopyrightText: 2026 The RISE Project
# SPDX-License-Identifier: MIT
name: Build and deploy website
on:
push:
branches: [main]
paths:
- "docs/**"
- "ci_scripts/dashboard/**"
pull_request:
types: [opened, synchronize, reopened, closed]
paths:
- "docs/**"
- "ci_scripts/dashboard/**"
workflow_dispatch:
concurrency:
group: website
cancel-in-progress: false
queue: max
jobs:
setup:
if: github.event_name != 'pull_request' || github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- run: true
preview:
if: github.event_name == 'pull_request'
needs: [setup]
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
if: github.event.action != 'closed'
with:
python-version: '3'
- name: Install site generator dependencies
if: github.event.action != 'closed'
run: pip install -r ci_scripts/requirements.txt
- name: Generate package pages from YAML
if: github.event.action != 'closed'
run: python ci_scripts/generate_packages_doc.py
- name: Compute preview baseurl
if: github.event.action != 'closed'
id: preview_baseurl
run: |
echo "value=/pr-preview/pr-${{ github.event.number }}" >> "$GITHUB_OUTPUT"
- uses: ruby/setup-ruby@14594264cd68ce8a2345dd349bc3d138a4ef85c8 # v1.327.0
if: github.event.action != 'closed'
with:
ruby-version: '3.3'
# actions/jekyll-build-pages has no way to override _config.yml's
# hardcoded baseurl, but a preview is served one path segment deeper
# (.../pr-preview/pr-<N>/) than the production site, so it needs its
# own baseurl or every internal link/asset would point at production.
- name: Build with Jekyll
if: github.event.action != 'closed'
run: |
# jekyll-remote-theme only fetches just-the-docs' layouts/assets;
# its own gem dependencies (jekyll-seo-tag, jekyll-include-cache,
# rake) still have to be installed separately.
gem install jekyll jekyll-remote-theme jekyll-seo-tag jekyll-include-cache rake --no-document
jekyll build --source docs --destination _site \
--baseurl "${{ steps.preview_baseurl.outputs.value }}"
# Auto-detects deploy vs. removal from the pull_request event action,
# so this same step both publishes updates and tears down the preview
# when the PR is closed.
#
# wait-for-pages-deployment is deliberately left at its default
# (false): on classic "deploy from a branch" Pages, its lookup against
# the legacy Pages Builds API doesn't reliably find an exact-commit
# build within its hardcoded 180s timeout, and that timeout is a hard,
# non-configurable `exit 1` that fails the whole step/PR check even
# when the preview deployed and is serving correctly. A link that's
# occasionally not live for a few seconds is a smaller problem than a
# misleading red X on an otherwise-working PR.
- name: Deploy or remove PR preview
uses: rossjrw/pr-preview-action@ffa7509e91a3ec8dfc2e5536c4d5c1acdf7a6de9 # v1.8.1
with:
source-dir: ./_site
deploy:
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main'
needs: [setup]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3'
- name: Install site generator dependencies
run: pip install -r ci_scripts/requirements.txt
- name: Generate package pages from YAML
run: python ci_scripts/generate_packages_doc.py
- name: Restore the dashboard's pypi.org response cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: requests-cache.sqlite
key: requests-cache-${{ github.ref }}
restore-keys: requests-cache-main
- name: Generate the dashboard
continue-on-error: true
run: |
python ci_scripts/dashboard/build.py --output-dir docs/dashboard
- name: Build with Jekyll
uses: actions/jekyll-build-pages@44a6e6beabd48582f863aeeb6cb2151cc1716697 # v1.0.13
with:
source: ./docs
destination: ./_site
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4.1.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_site
keep_files: true