forked from harvard-edge/cs249r_book
-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (114 loc) · 4.19 KB
/
Copy pathmlperf-edu-publish-live.yml
File metadata and controls
128 lines (114 loc) · 4.19 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
name: 'MLPerf EDU · Publish Independent Preview (Live)'
# Publishes only the documentation preview. It does not publish a Python
# package, create a benchmark release, or imply MLCommons endorsement.
on:
workflow_dispatch:
inputs:
description:
description: 'Description of the documentation update'
required: false
default: 'MLPerf EDU preview documentation update'
confirm:
description: 'Type PUBLISH to confirm the public site update'
required: true
default: ''
workflow_call:
inputs:
description:
type: string
required: false
default: 'MLPerf EDU preview documentation update'
confirm:
type: string
required: true
permissions:
contents: write
actions: read
env:
MLPERF_EDU_ROOT: mlperf-edu
MLPERF_EDU_DEPLOY_PATH: mlperf-edu
jobs:
dev-validation-guard:
name: 'Recent Dev Validation Gate'
if: inputs.confirm == 'PUBLISH'
uses: ./.github/workflows/infra-publish-guard.yml
with:
validate_workflow: mlperf-edu-validate-dev.yml
benchmark-validation-guard:
name: 'Recent Full Benchmark Gate'
if: inputs.confirm == 'PUBLISH'
uses: ./.github/workflows/infra-publish-guard.yml
with:
validate_workflow: mlperf-edu-release-validation.yml
max_age_minutes: 10080
build-and-deploy:
name: 'Build and Deploy the Independent Preview'
runs-on: ubuntu-latest
needs: [dev-validation-guard, benchmark-validation-guard]
if: inputs.confirm == 'PUBLISH'
timeout-minutes: 25
concurrency:
group: gh-pages-deploy
cancel-in-progress: false
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set Up uv and Python
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: '3.12'
enable-cache: true
cache-dependency-glob: '${{ env.MLPERF_EDU_ROOT }}/uv.lock'
working-directory: ${{ env.MLPERF_EDU_ROOT }}
- name: Set Up Quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: Install the Locked Environment
working-directory: ${{ env.MLPERF_EDU_ROOT }}
run: uv sync --locked --extra dev
- name: Build the Site
working-directory: ${{ env.MLPERF_EDU_ROOT }}
run: |
uv run python tools/generate_docs.py --check
quarto render site
touch site/_build/.nojekyll
- name: Deploy to GitHub Pages
shell: bash
env:
GH_PAGES_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
git clone --depth=1 --branch=gh-pages \
"https://x-access-token:${GH_PAGES_TOKEN}@github.com/${{ github.repository }}.git" \
gh-pages-repo
cd gh-pages-repo
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
rm -rf "$MLPERF_EDU_DEPLOY_PATH"
mkdir -p "$MLPERF_EDU_DEPLOY_PATH"
cp -r "$GITHUB_WORKSPACE/$MLPERF_EDU_ROOT/site/_build/." "$MLPERF_EDU_DEPLOY_PATH/"
test -f "$MLPERF_EDU_DEPLOY_PATH/index.html"
git add "$MLPERF_EDU_DEPLOY_PATH"
git commit -m "Deploy MLPerf EDU preview - ${{ github.sha }}" --allow-empty
for attempt in 1 2 3; do
if git push origin gh-pages; then
exit 0
fi
echo "Push attempt $attempt failed. Rebasing before retry."
git pull --rebase origin gh-pages
done
echo 'Live preview deployment failed after three attempts.'
exit 1
- name: Publish Summary
env:
PUBLISH_DESCRIPTION: ${{ inputs.description }}
PUBLISH_SHA: ${{ github.sha }}
run: |
{
echo '## MLPerf EDU Independent Preview Published'
echo ''
echo '- URL: https://mlsysbook.ai/mlperf-edu/'
echo "- Description: $PUBLISH_DESCRIPTION"
echo "- Commit: \`$PUBLISH_SHA\`"
echo ''
echo 'This deployment is documentation for an independent preview. It is not a package release or an MLCommons endorsement.'
} >> "$GITHUB_STEP_SUMMARY"