https://telecominfraproject.atlassian.net/browse/WIFI-13110 #37
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 OpenAPI docs on GitHub Pages | |
on: | |
push: | |
paths: | |
- 'openapi/**' | |
branches: | |
- master | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
docsgen: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Generate static HTML page with docs from OpenAPI definition | |
run: | | |
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v6.2.1 generate -i https://raw.githubusercontent.com/Telecominfraproject/wlan-cloud-ucentralgw/master/openapi/owgw.yaml -g html2 --skip-validate-spec -o /local/ | |
- name: Update OpenAPI docs | |
run: | | |
mkdir tmp-docs | |
mv index.html tmp-docs/index.html | |
mkdir -p ~/.ssh | |
ssh-keyscan -H github.com >> ~/.ssh/known_hosts | |
echo https://tip-automation:${{ secrets.GIT_PUSH_PAT }}@github.com > ~/.git-credentials | |
git config --global credential.helper store | |
git config --global user.email "[email protected]" | |
git config --global user.name "TIP Automation User" | |
git pull | |
git checkout gh-pages || git checkout -b gh-pages | |
rm -rf docs | |
mv tmp-docs docs | |
git add docs | |
git commit -m'Update OpenAPI docs for GitHub pages' | |
git push --set-upstream origin gh-pages |