Skip to content

tibiadata-api-docs-release-update #37

tibiadata-api-docs-release-update

tibiadata-api-docs-release-update #37

Workflow file for this run

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