Repository navigation
126 lines (125 loc) · 4.32 KB
/
Copy pathsite.yaml
File metadata and controls
126 lines (125 loc) · 4.32 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
# Copyright 2026 The Agent Substrate Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Builds the website in site/ on every pull request that could change it, and
# publishes it to GitHub Pages from main.
name: site
on:
pull_request:
paths:
- 'site/**'
- 'docs/**'
- 'demos/*/README.md'
- 'api/ateapi/v1/**'
- 'manifests/ate-install/generated/ate.dev_*.yaml'
- 'tools/apitool/**'
- 'tools/site-content/**'
- 'tools/site-release-data/**'
- 'hack/site.sh'
- 'hack/test-site-templates.sh'
- '.github/workflows/site.yaml'
push:
branches: [main]
paths:
- 'site/**'
- 'docs/**'
- 'demos/*/README.md'
- 'api/ateapi/v1/**'
- 'manifests/ate-install/generated/ate.dev_*.yaml'
- 'tools/apitool/**'
- 'tools/site-content/**'
- 'tools/site-release-data/**'
- 'hack/site.sh'
- 'hack/test-site-templates.sh'
- '.github/workflows/site.yaml'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
env:
# Keep in sync with module.hugoVersion.min in site/hugo.yaml.
HUGO_VERSION: 0.163.3
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
with:
# site-release-data needs the latest release tag and its history.
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
# The root module, for tools/site-release-data and tools/apitool,
# which pins the same toolchain. Hugo fetches Docsy with the same Go.
go-version-file: 'go.mod'
cache: false
- name: Setup Node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22
cache: npm
cache-dependency-path: site/package-lock.json
- name: Install Hugo
run: |
base="https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}"
tarball="hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz"
cd "${RUNNER_TEMP}"
curl -sSfLO "${base}/${tarball}"
curl -sSfLO "${base}/hugo_${HUGO_VERSION}_checksums.txt"
grep " ${tarball}\$" "hugo_${HUGO_VERSION}_checksums.txt" | sha256sum -c -
mkdir -p hugo && tar -xzf "${tarball}" -C hugo hugo
echo "${RUNNER_TEMP}/hugo" >> "${GITHUB_PATH}"
- name: Install PostCSS
working-directory: site
run: npm ci
- name: Generate site content
run: hack/site.sh content
- name: Generate release data
run: hack/site.sh release-data
- name: Test templates
if: github.event_name == 'pull_request'
run: hack/test-site-templates.sh
- name: Configure Pages
id: pages
if: github.event_name != 'pull_request'
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
- name: Build
working-directory: site
env:
BASE_URL: ${{ steps.pages.outputs.base_url }}
run: hugo build --environment production --minify ${BASE_URL:+--baseURL "${BASE_URL}/"}
- name: Upload artifact
if: github.event_name != 'pull_request'
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: site/public
deploy:
if: github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
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@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1