Repository navigation
55 lines (47 loc) · 1.69 KB
/
Copy pathdocs.yml
File metadata and controls
55 lines (47 loc) · 1.69 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
name: docs
permissions:
contents: read
on:
pull_request:
branches: [master]
push:
branches:
- master
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install Go
uses: actions/setup-go@7b8cf10d4e4a01d4992d18a89f4d7dc5a3e6d6f4 # v4
with:
go-version: 1.22.x
- name: Build documentation
run: |
rm -rf examples
rm -rf tests
go install github.com/johnstarich/go/gopages@latest
go install github.com/tdewolff/minify/v2/cmd/minify@v2.24.17
gopages -source-link "https://github.com/DataDog/datadog-api-client-go/blob/master/{{.Path}}{{if .Line}}#L{{.Line}}{{end}}" -brand-description "Datadog API client for GO" -brand-title "Datadog" -base /datadog-api-client-go
find dist -type f -name '*.html' -exec perl -ni -e 'print unless /^[\t ]+$/' {} +
# dist/lib/godoc contains Go templates, not standalone HTML.
find dist/pkg dist/src -type f -name '*.html' -exec minify --quiet --inplace {} +
- name: Upload GitHub Pages artifact
if: github.event_name == 'push'
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4
with:
path: ./dist
deploy:
if: github.event_name == 'push'
needs: publish
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4