-
-
Notifications
You must be signed in to change notification settings - Fork 19
46 lines (36 loc) · 1.25 KB
/
sync-openapi.yml
File metadata and controls
46 lines (36 loc) · 1.25 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
name: Sync OpenAPI spec
on:
push:
tags:
- "v*"
workflow_dispatch:
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout pvetui
uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: .go-version
- name: Generate OpenAPI spec
run: go run ./cmd/pve-openapi-gen -out docs/api/pve-openapi.yaml
- name: Push spec to pvetui-openapi
env:
PAT: ${{ secrets.OPENAPI_REPO_PAT }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git clone "https://x-access-token:${PAT}@github.com/devnullvoid/pvetui-openapi.git" /tmp/pvetui-openapi
cp docs/api/pve-openapi.yaml /tmp/pvetui-openapi/pve-openapi.yaml
cp docs/api/index.html /tmp/pvetui-openapi/index.html
cd /tmp/pvetui-openapi
git add pve-openapi.yaml index.html
if git diff --cached --quiet; then
echo "No changes to spec, skipping push."
exit 0
fi
VERSION="${GITHUB_REF_NAME}"
git commit -m "chore: sync spec from pvetui ${VERSION}"
git push