-
Notifications
You must be signed in to change notification settings - Fork 2
57 lines (47 loc) · 1.48 KB
/
godoc_preview.yaml
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
name: Generate Documentation Preview
on:
pull_request:
branches:
- "*"
push:
branches:
- "*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: "1.21"
- name: Install godoc
run: go install -v golang.org/x/tools/cmd/godoc@latest
- name: Generate Documentation
run: |
godoc -http=:6060 & sleep 5
curl -sSf http://localhost:6060/pkg/ > path/to/generated/documentation/index.html
- name: Upload Documentation Preview
uses: actions/upload-artifact@v2
with:
name: documentation-preview
path: path/to/generated/documentation
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download Documentation Preview
uses: actions/download-artifact@v2
with:
name: documentation-preview
path: path/to/generated/documentation
- name: Deploy Documentation Preview
run: |
# You can deploy the generated documentation preview to a hosting service
# For example, if you're using GitHub Pages:
mkdir -p docs
mv path/to/generated/documentation/* docs/${{ github.sha }}
git add docs
git commit -m "Update documentation preview"
git push origin HEAD