-
Notifications
You must be signed in to change notification settings - Fork 373
75 lines (67 loc) · 1.97 KB
/
Copy pathopenapi_deploy.yml
File metadata and controls
75 lines (67 loc) · 1.97 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
name: Deploy CF API V3 OpenAPI Documentation
on:
push:
branches:
- main
paths:
- 'docs/openapi/**'
- '.github/workflows/openapi_deploy.yml'
workflow_dispatch:
jobs:
deploy:
name: Build and publish to gh-pages
runs-on: ubuntu-latest
container:
image: node:24-alpine
permissions:
contents: write
actions: write
steps:
- name: Checkout main
uses: actions/checkout@v7
with:
path: main
- name: Setup
working-directory: main/docs/openapi
run: |
apk add python3 make g++ git tar
yarn install
- name: Build
working-directory: main/docs/openapi
run: yarn build
- name: Checkout gh-pages
uses: actions/checkout@v7
with:
ref: gh-pages
path: gh-pages
- name: Sync built docs into gh-pages/openapi
run: |
rm -rf gh-pages/openapi
mkdir -p gh-pages/openapi
cp -r main/docs/openapi/dist/. gh-pages/openapi/
- name: Commit and push
id: commit
working-directory: gh-pages
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add openapi
if git diff --cached --quiet; then
echo "No changes to publish"
echo "changed=false" >> "$GITHUB_OUTPUT"
else
git commit -m "Update openapi docs from ${GITHUB_SHA}"
git push
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
- name: Trigger Pages deployment
if: steps.commit.outputs.changed == 'true'
uses: actions/github-script@v7
with:
script: |
await github.rest.actions.createWorkflowDispatch({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'deploy_v3_docs.yml',
ref: 'gh-pages',
});