Repository navigation
106 lines (102 loc) · 2.97 KB
/
Copy pathdocs.yml
File metadata and controls
106 lines (102 loc) · 2.97 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
name: Docs
on:
pull_request:
branches:
- master
paths:
- 'docs/**'
- 'mkdocs.yml'
- 'gradle/docs.gradle'
- '.github/workflows/docs.yml'
# Publishes the `dev` version of the docs
push:
branches:
- master
paths:
- 'docs/**'
- 'mkdocs.yml'
- 'gradle/docs.gradle'
- '.github/workflows/docs.yml'
workflow_dispatch:
inputs:
version:
description: 'Docs version to publish (e.g. dev, 12.0)'
required: true
default: 'dev'
alias:
description: 'Optional alias for the version (e.g. latest)'
required: false
# Called by release.yml to publish the docs of a release
workflow_call:
inputs:
version:
description: 'Docs version to publish (e.g. 12.0)'
required: true
type: string
alias:
description: 'Optional alias for the version (e.g. latest)'
required: false
type: string
default: ''
ref:
description: 'Git ref to build the docs from (default: the triggering ref)'
required: false
type: string
default: ''
permissions:
contents: read
jobs:
check:
runs-on: ubuntu-latest
concurrency:
group: docs-check-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
steps:
- uses: actions/checkout@v7
with:
ref: ${{ inputs.ref }}
fetch-depth: 0
- uses: actions/setup-java@v6
with:
java-version: '17'
distribution: 'zulu'
- uses: astral-sh/setup-uv@v10.4.1
- uses: gradle/actions/setup-gradle@v6.4.1
- name: Build docs (strict)
run: ./gradlew docsCheck
deploy:
# Never from pull requests or other branches
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
needs: check
runs-on: ubuntu-latest
# One deploy at a time: they all push to the same branch
concurrency:
group: docs-deploy
cancel-in-progress: false
permissions:
contents: write
steps:
- uses: actions/checkout@v7
with:
ref: ${{ inputs.ref }}
fetch-depth: 0
- uses: actions/setup-java@v6
with:
java-version: '17'
distribution: 'zulu'
- uses: astral-sh/setup-uv@v10.4.1
- uses: gradle/actions/setup-gradle@v6.4.1
- name: Configure git identity for mike
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Deploy docs version
env:
DOCS_VERSION: ${{ inputs.version || 'dev' }}
DOCS_ALIAS: ${{ inputs.alias }}
run: |
args=(-PdocsVersion="$DOCS_VERSION")
if [ -n "$DOCS_ALIAS" ]; then args+=(-PdocsAlias="$DOCS_ALIAS"); fi
./gradlew docsDeploy "${args[@]}"
# The site root redirects to the latest release
if [ "$DOCS_ALIAS" = "latest" ]; then ./gradlew docsSetDefault -PdocsDefault=latest; fi