-
Notifications
You must be signed in to change notification settings - Fork 514
137 lines (117 loc) · 3.56 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
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 documentation
on:
pull_request:
push:
branches:
- '*'
tags:
- v*
workflow_dispatch:
schedule:
- cron: '25 7 * * 0'
jobs:
build-html-man-pdf:
runs-on: ubuntu-latest
name: Build documentation
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set release/tag
run: |
git describe --tags --long --always > RELEASE || true
git describe --tags --exact-match > TAG || true
- name: Build
uses: docker://docker.io/sphinxdoc/sphinx-latexpdf:latest
with:
entrypoint: make
args: html man latexpdf
- name: Archive artifacts (html)
uses: actions/upload-artifact@v4
if: github.event_name == 'push'
with:
name: html
path: _build/html
retention-days: 14
- name: Archive artifacts (man)
uses: actions/upload-artifact@v4
if: github.event_name == 'push'
with:
name: man
path: _build/man
retention-days: 14
- name: Archive artifacts (pdf)
uses: actions/upload-artifact@v4
if: github.event_name == 'push'
with:
name: pdf
path: _build/latex/*.pdf
retention-days: 14
upload:
runs-on: ubuntu-latest
name: Upload rendered site
needs: build-html-man-pdf
environment: github-pages
if: github.event_name == 'push' && github.ref_type == 'tag'
steps:
- name: Prepare site (html)
uses: actions/download-artifact@v4
with:
name: html
path: _site
- name: Prepare site (man)
uses: actions/download-artifact@v4
with:
name: man
path: _site/man
- name: Prepare site (pdf)
uses: actions/download-artifact@v4
with:
name: man
path: _site/man
- name: Upload rendered site
uses: docker://docker.io/rclone/rclone:latest
env:
RCLONE_CONFIG_OBJSTORE_TYPE: s3
RCLONE_CONFIG_OBJSTORE_PROVIDER: ${{ secrets.S3_PROVIDER }}
RCLONE_CONFIG_OBJSTORE_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
RCLONE_CONFIG_OBJSTORE_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
RCLONE_CONFIG_OBJSTORE_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
RCLONE_CONFIG_OBJSTORE_REGION: ${{ secrets.S3_REGION }}
with:
args: sync _site objstore:${{ secrets.S3_BUCKET }}/${{ github.ref_name }}
publish:
runs-on: ubuntu-latest
name: Publish to GitHub pages
needs: build-html-man-pdf
environment: github-pages
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
pages: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Prepare site (pre-rendered)
run: |
git clone --depth 1 https://github.com/syncthing/docs-pre-rendered.git _site
rm -rf _site/.git
go run _script/lsver.go _site > _site/versions.json
- name: Prepare site (html)
uses: actions/download-artifact@v4
with:
name: html
path: _site
- name: Prepare site (man)
uses: actions/download-artifact@v4
with:
name: man
path: _site/man
- name: Prepare site (pdf)
uses: actions/download-artifact@v4
with:
name: man
path: _site/man
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4