-
Notifications
You must be signed in to change notification settings - Fork 1
137 lines (119 loc) · 3.23 KB
/
build_docs.yml
File metadata and controls
137 lines (119 loc) · 3.23 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
name: Build the web book
on:
workflow_dispatch:
inputs:
minecraft-version:
description: Minecraft version to export
type: choice
options:
- '1.18.2'
- '1.19.2'
- '1.20.1'
- '1.20.2'
- '1.21.0'
release:
description: Release this version
type: boolean
default: false
publish:
description: Package index to publish to
type: choice
options:
- none
- PyPI
workflow_call:
inputs:
minecraft-version:
type: string
release:
type: boolean
publish:
type: string
env:
HATCH_GRADLE_DIR: versions/${{ inputs.minecraft-version }}
HEXDOC_PROPS: versions/${{ inputs.minecraft-version }}/hexdoc.toml
HEXDOC_RELEASE: ${{ inputs.release }}
PYPI_PACKAGE: hexdoc-minecraft
PYTHON_VERSION: '3.11'
permissions:
contents: read
pages: read
jobs:
build:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
pages: read
outputs:
pages-url: ${{ steps.export.outputs.pages-url }}
matrix: ${{ steps.export.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- uses: object-Object/ci/setup@v0
with:
python-version: "3.11"
python-packages: nox
- name: Install display server
uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: xvfb
- name: Build package
id: export
run: xvfb-run --auto-servernum nox --session build
- name: Upload hexdoc cache artifact
uses: actions/upload-artifact@v4
with:
name: hexdoc-cache
path: .hexdoc
- name: Upload temporary Pages artifact
uses: actions/upload-artifact@v4
with:
name: github-pages-tmp
path: _site
- name: Upload package artifact
uses: actions/upload-artifact@v4
with:
name: hexdoc-build
path: dist
- name: Add job summary
run: echo "Built version \`$(hatch version)\` from commit \`$(git rev-parse --short "$GITHUB_SHA")\`." >> $GITHUB_STEP_SUMMARY
deploy-pages:
needs: build
runs-on: ubuntu-latest
concurrency:
group: hexdoc-deploy-pages
cancel-in-progress: false
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download temporary Pages artifact
uses: actions/download-artifact@v4
with:
name: github-pages-tmp
path: _site
- name: Deploy to Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: _site
target-folder: docs
clean: false
publish-pypi:
runs-on: ubuntu-latest
needs: [build, deploy-pages]
if: inputs.release == true && inputs.publish == 'PyPI'
environment:
name: pypi
url: https://pypi.org/p/${{ env.PYPI_PACKAGE }}
permissions:
id-token: write
steps:
- name: Download package artifact
uses: actions/download-artifact@v4
with:
name: hexdoc-build
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1