forked from FerretDB/FerretDB
-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (105 loc) · 3.08 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
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
---
name: Docs
on:
pull_request:
types:
- unlabeled # if GitHub Actions stuck, add and remove "not ready" label to force rebuild
- opened
- reopened
- synchronize
push:
branches:
- main
- main-*
- releases/*
schedule:
- cron: "12 0 * * *"
# Do not run this workflow in parallel for any PR change or branch push
# to prevent concurrent deployments to GitHub Pages.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: false
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
GOTOOLCHAIN: local
jobs:
build:
name: Build docs
runs-on: ubuntu-22.04
timeout-minutes: 10
if: github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'not ready')
steps:
# TODO https://github.com/FerretDB/github-actions/issues/211
- name: Checkout code
uses: actions/checkout@v4
with:
lfs: true
# This step will fail with "Error: Resource not accessible by integration"
# while trying to add label and comment to PR, that is not possible for PRs from forks.
# See https://github.com/ppremk/lfs-warning/issues/147.
# But the real issue will be right above that message: a list of files that should be added using Git LFS.
- name: Check LFS status
uses: ppremk/lfs-warning@v3.3
with:
filesizelimit: 102400b
labelName: use-git-lfs
exclusionPatterns: |
**/*.js
**/*.md
**/go.sum
- name: Setup Go
uses: FerretDB/github-actions/setup-go@main
with:
cache-key: docs
- 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: Create directory
run: mkdir tmp
- name: Archive docs
run: >
tar --directory website/build
--file tmp/docs.tar
--create
--verbose
.
# it has to be exactly "docs.tar" for actions/deploy-pages below
- name: Upload archive artifact
uses: actions/upload-artifact@v4
with:
name: docs
path: tmp/docs.tar
retention-days: 1
if-no-files-found: error
- name: Check dirty
run: |
git status
git diff --exit-code
github:
name: Deploy to GitHub Pages
runs-on: ubuntu-22.04
timeout-minutes: 10
# exclude pull_request and schedule
needs: build
if: github.event_name == 'push'
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deploy
uses: actions/deploy-pages@v4
with:
artifact_name: docs
timeout: 300000 # 5*60*1000 milliseconds