fix(ci): wire release-please PAT into reusable workflow caller (#27) #23
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: Deploy Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| tags: | |
| - "v[0-9]+.[0-9]+.[0-9]+" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| # Single owner of the GitHub Pages deployment. Both the documentation site and | |
| # the schema registry are built into one artifact so a docs push and a schema | |
| # tag can never clobber each other on the single Pages origin. | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 | |
| with: | |
| python-version: 3.x | |
| - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| # Build the documentation site first. mkdocs cleans its output directory, | |
| # so the registry must be assembled into ./site afterwards. | |
| - run: pip install mkdocs-material | |
| - run: mkdocs build | |
| - run: npm ci | |
| - run: npm test | |
| - name: Build every released schema version into ./site/registry | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| rm -rf registry release-source | |
| tags="$(git tag --list "v[0-9]*.[0-9]*.[0-9]*" --sort=version:refname)" | |
| if [[ -z "$tags" ]]; then | |
| echo "No release tags found; deploying documentation without a schema registry." | |
| exit 0 | |
| fi | |
| while IFS= read -r tag; do | |
| version="${tag#v}" | |
| line="v${version%.*}" | |
| mkdir -p "release-source/$version" | |
| git archive "$tag" "schemas/$line" | tar -x -C "release-source/$version" | |
| node scripts/build-registry.mjs \ | |
| --version "$version" \ | |
| --source "release-source/$version/schemas/$line" \ | |
| --output registry \ | |
| --append | |
| done <<< "$tags" | |
| npm run validate:registry -- --registry registry | |
| # The registry is served as a sub-path of the single Pages site, so it | |
| # must not carry its own CNAME (that would remap the whole origin). | |
| rm -f registry/CNAME | |
| mkdir -p site/registry | |
| cp -R registry/. site/registry/ | |
| - uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0 | |
| - uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 | |
| with: | |
| path: ./site | |
| deploy: | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0 |