-
Notifications
You must be signed in to change notification settings - Fork 0
165 lines (164 loc) · 6.96 KB
/
build.yaml
File metadata and controls
165 lines (164 loc) · 6.96 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
run-name: build ${{ github.event.inputs.reference }}
on:
workflow_dispatch:
inputs:
reference:
description: 'Commit reference from CPython repository'
required: true
default: '3.14'
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@master
with:
python-version: 3
- uses: actions/checkout@master
with:
repository: m-aciek/cpython
ref: ${{ github.event.inputs.reference }}
- run: make venv
working-directory: ./Doc
- run: sudo apt-get update
- run: sudo apt-get install -y latexmk texlive-xetex fonts-freefont-otf xindy texinfo librsvg2-bin
- run: make dist-html
id: build-html
working-directory: ./Doc
continue-on-error: true
- run: make dist-text
id: build-text
working-directory: ./Doc
continue-on-error: true
- run: make dist-texinfo
id: build-texinfo
working-directory: ./Doc
continue-on-error: true
- run: make dist-epub
id: build-epub
working-directory: ./Doc
continue-on-error: true
- run: make dist-pdf
id: build-pdf
working-directory: ./Doc
continue-on-error: true
- uses: actions/upload-artifact@master
with:
name: pdf-logs.zip
path: |
./Doc/build/latex/*.log
./Doc/build/latex/*.tex
- uses: actions/upload-artifact@master
with:
name: docs-pdf-a4.zip
path: ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-pdf-a4.zip
if-no-files-found: ignore
- uses: actions/upload-artifact@master
with:
name: docs-pdf-a4.tar.bz2
path: ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-pdf-a4.tar.bz2
if-no-files-found: ignore
- uses: actions/upload-artifact@master
with:
name: docs-html.zip
path: ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-html.zip
if-no-files-found: ignore
- uses: actions/upload-artifact@master
with:
name: docs-html.tar.bz2
path: ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-html.tar.bz2
if-no-files-found: ignore
- uses: actions/upload-artifact@master
with:
name: docs-text.zip
path: ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-text.zip
if-no-files-found: ignore
- uses: actions/upload-artifact@master
with:
name: docs-text.tar.bz2
path: ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-text.tar.bz2
if-no-files-found: ignore
- uses: actions/upload-artifact@master
with:
name: docs-texinfo.zip
path: ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-texinfo.zip
if-no-files-found: ignore
- uses: actions/upload-artifact@master
with:
name: docs-texinfo.tar.bz2
path: ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-texinfo.tar.bz2
if-no-files-found: ignore
- uses: actions/upload-artifact@master
with:
name: docs.epub
path: ./Doc/dist/python-${{ github.event.inputs.reference }}-docs.epub
if-no-files-found: ignore
- name: Checkout gh-pages branch
uses: actions/checkout@v4
with:
ref: gh-pages
path: gh-pages
- name: Copy generated archives to gh-pages
run: |
mkdir -p gh-pages/3
# PDF
cp ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-pdf-a4.zip gh-pages/3/python-${{ github.event.inputs.reference }}-docs-pdf-a4.zip 2>/dev/null || true
cp ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-pdf-a4.tar.bz2 gh-pages/3/python-${{ github.event.inputs.reference }}-docs-pdf-a4.tar.bz2 2>/dev/null || true
# HTML
cp ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-html.zip gh-pages/3/python-${{ github.event.inputs.reference }}-docs-html.zip 2>/dev/null || true
cp ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-html.tar.bz2 gh-pages/3/python-${{ github.event.inputs.reference }}-docs-html.tar.bz2 2>/dev/null || true
# Text
cp ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-text.zip gh-pages/3/python-${{ github.event.inputs.reference }}-docs-text.zip 2>/dev/null || true
cp ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-text.tar.bz2 gh-pages/3/python-${{ github.event.inputs.reference }}-docs-text.tar.bz2 2>/dev/null || true
# Texinfo
cp ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-texinfo.zip gh-pages/3/python-${{ github.event.inputs.reference }}-docs-texinfo.zip 2>/dev/null || true
cp ./Doc/dist/python-${{ github.event.inputs.reference }}-docs-texinfo.tar.bz2 gh-pages/3/python-${{ github.event.inputs.reference }}-docs-texinfo.tar.bz2 2>/dev/null || true
# EPUB
cp ./Doc/dist/python-${{ github.event.inputs.reference }}-docs.epub gh-pages/3/python-${{ github.event.inputs.reference }}-docs.epub 2>/dev/null || true
- name: Commit generated archives
id: commit
run: |
cd gh-pages
git config user.name github-actions
git config user.email github-actions@github.com
git add 3/python-${{ github.event.inputs.reference }}-docs-* || true
if git diff --cached --quiet; then
echo "No documentation archives to commit"
echo "has_changes=false" >> $GITHUB_OUTPUT
else
git commit -m "Update documentation archives for ${{ github.event.inputs.reference }}"
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
- name: Push commit
if: steps.commit.outputs.has_changes == 'true'
uses: ad-m/github-push-action@master
with:
branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
directory: gh-pages
- name: Check for build failures
if: always()
run: |
failed_formats=()
if [ "${{ steps.build-html.outcome }}" == "failure" ]; then
failed_formats+=("HTML")
fi
if [ "${{ steps.build-text.outcome }}" == "failure" ]; then
failed_formats+=("Text")
fi
if [ "${{ steps.build-texinfo.outcome }}" == "failure" ]; then
failed_formats+=("Texinfo")
fi
if [ "${{ steps.build-epub.outcome }}" == "failure" ]; then
failed_formats+=("EPUB")
fi
if [ "${{ steps.build-pdf.outcome }}" == "failure" ]; then
failed_formats+=("PDF")
fi
if [ ${#failed_formats[@]} -gt 0 ]; then
echo "The following format(s) failed to build: ${failed_formats[*]}"
exit 1
else
echo "All formats built successfully"
fi