-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (48 loc) · 1.82 KB
/
update.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
49
50
51
52
53
54
55
56
57
58
name: update
on:
repository_dispatch:
types:
- tibiadata-api-docs-release-update
permissions:
contents: write
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download swagger.json from tibiadata-api-go release
uses: robinraju/release-downloader@v1.11
with:
repository: TibiaData/tibiadata-api-go
tag: ${{ github.event.client_payload.tag_name }}
fileName: swagger.json
out-file-path: docs
- name: Manipulate docs/swagger files with custom settings
run: |
# set scheme for server to only https
contents="$(jq '.schemes = ["https"]' docs/swagger.json)" && \
echo "${contents}" > docs/swagger.json
# making copy for new synced dev doc
cp docs/swagger.json docs/swagger-dev.json
# set api hosts
contents_api="$(jq '.host = "api.tibiadata.com"' docs/swagger.json)" && \
contents_dev="$(jq '.host = "dev.tibiadata.com"' docs/swagger-dev.json)" && \
echo "${contents_api}" > docs/swagger.json
echo "${contents_dev}" > docs/swagger-dev.json
# set version for dev to edge
contents="$(jq '.info.version = "edge"' docs/swagger-dev.json)" && \
echo "${contents}" > docs/swagger-dev.json
- name: Commit docs/swagger files to repo
uses: EndBug/add-and-commit@v9
with:
add: docs/swagger.json docs/swagger-dev.json
message: automatic update of docs/swagger files (release ${{ github.event.client_payload.tag_name }})
deploy:
runs-on: ubuntu-latest
needs: update
steps:
- name: Trigger github-pages workflow
uses: peter-evans/repository-dispatch@v3
with:
event-type: tibiadata-api-docs-deploy