Merge pull request #35 from runZeroInc/enhance/add-tasks-export #44
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: Build PDF and zip | |
on: | |
push: | |
branches: [main] | |
paths: [runzero-api.yml] | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build PDF | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Install NodeJS | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "16" | |
- name: Install dependencies | |
run: npm install | |
- name: Generate HTML docs | |
run: | | |
npx openapi-generator-cli generate -i runzero-api.yml -g html -o pdfgen/html -c pdfgen/config.yaml | |
# Workaround for https://github.com/OpenAPITools/openapi-generator/issues/11292 | |
sed -i '{ /<div class="param">.*Minus/s/Minus/-/g }' pdfgen/html/index.html | |
- name: HTML to PDF | |
run: node pdfgen/makepdf.js | |
- name: Build swagger-ui-dist version of docs | |
run: | | |
mkdir runzero-api | |
cp -r node_modules/swagger-ui-dist/* runzero-api/ | |
cp offline-docs/README.md runzero-api | |
node offline-docs/splice.js | |
rm -f runzero-api.zip | |
zip -9vr runzero-api.zip runzero-api | |
- name: Commit files | |
run: | | |
git config --local user.name "GitHub action" | |
git add runzero-api.pdf | |
git add runzero-api.zip | |
git commit -m "Update offline PDF and zip" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
force: true |