Repository navigation
128 lines (110 loc) · 3.54 KB
/
Copy pathdocs.yml
File metadata and controls
128 lines (110 loc) · 3.54 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
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
125
126
127
128
name: API Docs
on:
push:
branches:
- main
paths-ignore:
- "docs/api/swagger.yaml"
pull_request:
paths:
- "api/**/*"
- "scripts/generate-swagger.sh"
- "scripts/generate-swagger-ui.sh"
jobs:
api-swagger:
name: Generate swagger.yaml
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version-file: "go.mod"
cache: false
- name: Make swagger.yaml
run: ./scripts/generate-swagger.sh
- name: Publish Artifact
uses: actions/upload-artifact@v7
with:
name: swagger.yaml
path: docs/api/swagger.yaml
- name: Check if there is a difference
uses: mathiasvr/command-output@v2.0.0
id: diff
with:
run: git diff --no-color docs/api/swagger.yaml
- name: Mark previous comment as outdated if no diff
if: ${{ github.event_name == 'pull_request' && steps.diff.outputs.stdout == '' }}
uses: marocchino/sticky-pull-request-comment@v3
with:
header: diff
hide: true
hide_classify: "OUTDATED"
- name: Post comment with diff in original PR
if: ${{ github.event_name == 'pull_request' && steps.diff.outputs.stdout }}
uses: marocchino/sticky-pull-request-comment@v3
with:
header: diff
message: |
This PR introduces the following changes in the API documentation:
```diff
${{ steps.diff.outputs.stdout }}
```
- name: Commit and push if stage is outdated
if: ${{ github.event_name == 'push' && steps.diff.outputs.stdout }}
run: |
git config user.name "github-actions"
git config user.email "github-actions@users.noreply.github.com"
git add docs/api/swagger.yaml
git commit -m "ci: regenerate swagger.yaml after merge"
git push
deploy-pages:
name: Deploy docs site and Swagger UI to GitHub Pages
needs: api-swagger
if: github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
concurrency:
group: pages
cancel-in-progress: false
steps:
- uses: actions/checkout@v7
- name: Overwrite docs/api/swagger.yaml with the freshly generated spec
uses: actions/download-artifact@v7
with:
name: swagger.yaml
path: docs/api
- name: Generate Swagger UI assets
run: ./scripts/generate-swagger-ui.sh
- uses: actions/configure-pages@v6
id: pages
- name: Build docs site with docs-tabler-theme
uses: lucasmenendez/docs-tabler-theme@main
with:
content-path: docs
title: "SimpleAuth.link"
description: "Passwordless authentication for your users using just an email address."
baseurl: ${{ steps.pages.outputs.base_path }}
static-path: docs/api
static-dest: dev/api
checkout: false
favicon: assets/favicon.ico
logo: assets/logo-dark.svg
logo-dark: assets/logo-light.svg
theme: light
- name: Upload built site
uses: actions/upload-pages-artifact@v5
with:
path: _site
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5