tibiadata-api-go-release #32
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: update | |
on: | |
repository_dispatch: | |
types: [tibiadata-api-go-release] | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download swagger.json from tibiadata-api-go release | |
uses: i3h/download-release-asset@v1 | |
with: | |
owner: TibiaData | |
repo: tibiadata-api-go | |
tag: ${{ github.event.client_payload.tag_name }} | |
file: swagger.json | |
path: docs | |
token: ${{ github.GITHUB_TOKEN }} | |
- 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 }}) |