-
-
Notifications
You must be signed in to change notification settings - Fork 16
48 lines (42 loc) · 1.48 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
name: Generate Documentation
on:
push:
branches:
- "main"
- "stable"
jobs:
docs:
name: Generate Docs
runs-on: ubuntu-latest
if: github.repository_owner == 'gominima'
outputs:
REPO_NAME: ${{ steps.env.outputs.REPO_NAME }}
BRANCH_NAME: ${{ steps.env.outputs.BRANCH_NAME }}
BRANCH_OR_TAG: ${{ steps.env.outputs.BRANCH_OR_TAG }}
SHA: ${{ steps.env.outputs.SHA }}
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Setup Go environment
uses: actions/[email protected]
with:
go-version: 1.17
- name: Get docgen
run: go get github.com/gominima/docgen
- name: Run docgen
run: go run github.com/gominima/docgen . $(basename `git rev-parse --show-toplevel`)-$(git rev-parse --abbrev-ref HEAD).json
- name: Checkout docs repository
uses: actions/checkout@v2
with:
repository: 'gominima/docs'
token: ${{ secrets.API_TOKEN_GITHUB }}
path: 'out'
- name: Commit and push
run: |
mv $(basename `git rev-parse --show-toplevel`)-$(git rev-parse --abbrev-ref HEAD).json out
cd out
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git add .
git commit -m "Docs build for ${GITHUB_REF_TYPE} ${GITHUB_REF_NAME}: ${GITHUB_SHA}" || true
git push