Add affiliate program section to README #26
This file contains hidden or 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: pages | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| jobs: | |
| deploy: | |
| name: Publish docs.livetennisapi.com | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.12' | |
| - run: pip install pyyaml | |
| - name: Assemble the site | |
| run: | | |
| # The reference loads the spec from its own origin, so the spec has to | |
| # travel with the site rather than be linked one directory up. | |
| cp openapi.yaml docs/openapi.yaml | |
| # Regenerate the plain-HTML reference so it can never drift from the | |
| # spec. Without it the docs are invisible to answer engines, none of | |
| # which execute JavaScript. | |
| python scripts/build_reference.py | |
| ls -la docs/ | |
| - name: The reference must be readable without JavaScript | |
| run: | | |
| python - <<'PY' | |
| import re, sys | |
| html = open('docs/reference.html', encoding='utf-8').read() | |
| text = re.sub(r'<script.*?</script>|<style.*?</style>', '', html, flags=re.S) | |
| text = ' '.join(re.sub(r'<[^>]+>', ' ', text).split()) | |
| required = ['/matches', '/players', 'win_probability_p1', 'ULTRA', 'BASIC', 'upgrade_required'] | |
| missing = [k for k in required if k not in html] | |
| if len(text) < 5000 or missing: | |
| print(f'FAIL: {len(text)} chars, missing {missing}') | |
| sys.exit(1) | |
| print(f'OK - {len(text):,} chars of crawlable text, all key terms present') | |
| PY | |
| - uses: actions/configure-pages@v6 | |
| - uses: actions/upload-pages-artifact@v5 | |
| with: | |
| path: docs | |
| - id: deployment | |
| uses: actions/deploy-pages@v5 |