-
Notifications
You must be signed in to change notification settings - Fork 2
84 lines (75 loc) · 2.25 KB
/
build.yml
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
name: build
on:
push:
branches:
- main
workflow_dispatch:
inputs:
run_id:
description: 'Run id for rendering job (defaults to latest)'
required: false
type: number
repository_dispatch:
types: [doc-rebuild]
permissions:
pages: write
contents: read
id-token: write
env:
GH_TOKEN: ${{ github.token }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get run_id from repository dispatch
if: ${{ github.event_name == 'repository_dispatch' }}
run: echo "run_id=${{ github.event.client_payload.run_id }}" >> "$GITHUB_ENV"
- name: Get run_id from workflow dispatch
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
if [ -z "${{ inputs.run_id }}" ]; then
run_id=$(gh run list -R g-adopt/g-adopt -w render.yml -L 1 --json databaseId --jq '.[].databaseId')
else
run_id=${{ inputs.run_id }}
fi
echo "run_id=${run_id}" >> "$GITHUB_ENV"
- name: Get run_id for push
if: ${{ github.event_name == 'push' }}
run: |
run_id=$(gh run list -R g-adopt/g-adopt -w render.yml -L 1 -b master -s success --json databaseId --jq '.[].databaseId')
echo "run_id=${run_id}" >> "$GITHUB_ENV"
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
cache: pip
- name: Install Python dependencies
run: |
pip install -r requirements.txt
- name: Clone G-ADOPT for API documentation
uses: actions/checkout@v4
with:
repository: g-adopt/g-adopt
path: g-adopt
- name: Download rendered notebooks
uses: actions/download-artifact@v4
with:
name: notebooks
path: docs/tutorials
github-token: ${{ github.token }}
repository: g-adopt/g-adopt
run-id: ${{ env.run_id }}
- name: Build site
run: |
mkdocs build --clean
- uses: actions/upload-pages-artifact@v3
with:
path: site
deploy:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
steps:
- uses: actions/deploy-pages@v4