46 lines (38 loc) · 1.33 KB
/
documentation.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
name: documentation
on:
release:
types: [published]
jobs:
documentation:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Install swag by swaggo
run: |
go install github.com/swaggo/swag/cmd/swag@latest
- name: Run swag to initiate docs
run: |
swag init --dir=src/
- name: Manipulate swagger.json with Release info
run: |
# set version of swagger.json to release name
contents="$(jq '.info.version = "${{ github.event.release.tag_name }}"' docs/swagger.json)" && \
echo "${contents}" > docs/swagger.json
- name: Upload swagger.json to release page
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: docs/swagger.json
tag: ${{ github.ref }}
- name: Trigger workflow in tibiadata-api-docs repo
run: |
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-d '{"ref":"main"}' \
https://api.github.com/repos/TibiaData/tibiadata-api-docs/actions/workflows/update.yml/dispatches