flashtrace-release #9
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 site | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: {} | |
| # fired by flashtrace/flashtrace's release workflow after every release, | |
| # with client_payload.tag = the new release tag | |
| repository_dispatch: | |
| types: [flashtrace-release] | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| # docs are built from the released tool, not its main branch: take the | |
| # tag from the dispatch payload, or fall back to the latest release. | |
| # An empty tag would make the checkout below silently use the default | |
| # branch, so fail loudly instead. | |
| - name: Resolve flashtrace release ref | |
| id: ref | |
| run: | | |
| tag="$RAW_TAG" | |
| if [ -z "$tag" ]; then | |
| tag=$(gh release view --repo flashtrace/flashtrace --json tagName --jq .tagName) || true | |
| fi | |
| if [ -z "$tag" ]; then | |
| echo "::error::no release tag: dispatch payload was empty and flashtrace/flashtrace has no published release" | |
| exit 1 | |
| fi | |
| echo "tag=$tag" >> "$GITHUB_OUTPUT" | |
| env: | |
| # env, not inline ${{ }}: the dispatch payload is untrusted input and | |
| # must reach the shell as data, never as script text | |
| RAW_TAG: ${{ github.event.client_payload.tag }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| repository: flashtrace/flashtrace | |
| ref: ${{ steps.ref.outputs.tag }} | |
| path: flashtrace | |
| - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 | |
| - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm build | |
| env: | |
| FLASHTRACE_REF: ${{ steps.ref.outputs.tag }} | |
| - uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 | |
| with: | |
| path: dist | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deploy.outputs.page_url }} | |
| steps: | |
| - id: deploy | |
| uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0 |