-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (48 loc) · 2 KB
/
update.yml
File metadata and controls
58 lines (48 loc) · 2 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
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@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
- name: Download swagger.json from tibiadata-api-go release
uses: robinraju/release-downloader@28fc21f50d76778e7023361aa1f863e717d3d56f #v1.13
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@290ea2c423ad77ca9c62ae0f5b224379612c0321 #v10.0.0
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@28959ce8df70de7be546dd1250a005dd32156697 #v4.0.1
with:
event-type: tibiadata-api-docs-deploy