92 lines (76 loc) · 1.93 KB
/
docs.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
---
name: Docs
on:
pull_request:
types:
- unlabeled # if GitHub Actions stuck, add and remove "no ci" label to force rebuild
- opened
- reopened
- synchronize
push:
branches:
- main
schedule:
- cron: "42 3 * * *" # after Integration workflow
env:
GOPATH: /home/runner/go
GOCACHE: /home/runner/go/cache
GOLANGCI_LINT_CACHE: /home/runner/go/cache/lint
GOMODCACHE: /home/runner/go/mod
GOPROXY: https://proxy.golang.org
jobs:
build:
name: Build docs
runs-on: ubuntu-20.04
if: github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'no ci')
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
lfs: true
- name: Setup Go
uses: FerretDB/github-actions/setup-go@main
with:
cache-key: build
- name: Install Task
run: go generate -x
working-directory: tools
- name: Build tools
run: bin/task env-pull
- name: Build docs
run: bin/task docs
- name: Archive docs
run: |
tar --directory website/build \
--file docs.tar \
--create \
--verbose \
.
- name: Upload archive artifact
uses: actions/upload-artifact@v3
with:
name: docs
path: docs.tar
if-no-files-found: error
- name: Check dirty
run: |
git status
git diff --exit-code
pages:
name: Deploy to Pages
runs-on: ubuntu-20.04
needs: build
if: github.event_name == 'push'
permissions:
pages: write
id-token: write
environment:
name: docs
url: ${{ steps.deploy.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deploy
uses: actions/deploy-pages@v1
with:
artifact_name: docs
timeout: 300000 # 5*60*1000 milliseconds