mirror of
https://github.com/tdlight-team/tdlight-telegram-bot-api.git
synced 2024-09-01 12:05:41 +02:00
Merge pull request #28 from code1mountain/docs
Add Swagger Docs on Github pages
This commit is contained in:
commit
abcce9d33f
46
.github/workflows/docs-gh-pages.yml
vendored
Normal file
46
.github/workflows/docs-gh-pages.yml
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
name: Generate and Deploy Swagger Docs on Github Pages
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- tdlight-api-openapi.yaml
|
||||
|
||||
jobs:
|
||||
docs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Get latest swagger version
|
||||
id: swagger-ui
|
||||
run: |
|
||||
echo ::set-output name=release_tag::$(curl -sL https://api.github.com/repos/swagger-api/swagger-ui/releases/latest | jq -r ".tag_name")
|
||||
- name: Generate Docs
|
||||
env:
|
||||
RELEASE_TAG: ${{ steps.swagger-ui.outputs.release_tag }}
|
||||
SWAGGER_YAML: "tdlight-api-openapi.yaml"
|
||||
TITLE: "tdlight Telegram bot API docs"
|
||||
run: |
|
||||
mkdir docs
|
||||
cp -r icons/ docs/icons/
|
||||
cp tdlight-api-openapi.yaml docs/tdlight-api-openapi.yaml
|
||||
cd docs
|
||||
# Download the release
|
||||
curl -sL -o $RELEASE_TAG https://api.github.com/repos/swagger-api/swagger-ui/tarball/$RELEASE_TAG
|
||||
# Extract the dist directory
|
||||
tar -xzf $RELEASE_TAG --strip-components=1 $(tar -tzf $RELEASE_TAG | head -1 | cut -f1 -d"/")/dist
|
||||
rm $RELEASE_TAG
|
||||
# Move index.html
|
||||
mv dist/index.html .
|
||||
# Fix references in index.html
|
||||
sed -i "s|https://petstore.swagger.io/v2/swagger.json|$SWAGGER_YAML|g" index.html
|
||||
sed -i "s|href=\"./|href=\"dist/|g" index.html
|
||||
sed -i "s|src=\"./|src=\"dist/|g" index.html
|
||||
sed -i "s|dist/favicon|icons/favicon|g" index.html
|
||||
sed -i "s|<title>.*</title>|<title>$TITLE</title>|g" index.html
|
||||
- name: Deploy
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./docs
|
13
.github/workflows/validate-swagger.yml
vendored
Normal file
13
.github/workflows/validate-swagger.yml
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
name: Documentation
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Validate openAPI
|
||||
id: validate
|
||||
uses: mbowman100/swagger-validator-action@2.0
|
||||
with:
|
||||
files: tdlight-api-openapi.yaml
|
BIN
icons/favicon-16x16.png
Normal file
BIN
icons/favicon-16x16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 657 B |
BIN
icons/favicon-196x196.png
Normal file
BIN
icons/favicon-196x196.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
BIN
icons/favicon-32x32.png
Normal file
BIN
icons/favicon-32x32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
12104
tdlight-api-openapi.yaml
Normal file
12104
tdlight-api-openapi.yaml
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user