ci: persist cargo caches on runner volume #104
Workflow file for this run
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: Preview Deploy | |
| on: | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| inputs: | |
| voice_ref: | |
| description: "wavekat-voice ref (branch/tag/sha) to pull docs from. Empty = default (latest tag)." | |
| required: false | |
| default: "" | |
| cli_ref: | |
| description: "wavekat-cli ref. Empty = default (latest tag)." | |
| required: false | |
| default: "" | |
| permissions: | |
| pull-requests: write | |
| jobs: | |
| deploy: | |
| runs-on: [self-hosted, wavekat-ci] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| persist-credentials: false | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| - run: npm ci | |
| - run: npm run cf:build | |
| env: | |
| SYNC_DOCS_TOKEN: ${{ secrets.SYNC_DOCS_TOKEN }} | |
| SYNC_DOCS_REF_VOICE: ${{ inputs.voice_ref }} | |
| SYNC_DOCS_REF_CLI: ${{ inputs.cli_ref }} | |
| - name: Deploy preview | |
| id: deploy | |
| run: | | |
| OUTPUT=$(npx wrangler pages deploy ./dist --project-name=wavekat-com --branch="${{ github.head_ref || github.ref_name }}" 2>&1) | |
| echo "$OUTPUT" | |
| ALIAS=$(echo "$OUTPUT" | grep -oP '(?<=Deployment alias URL: )https://\S+') | |
| echo "url=${ALIAS}" >> "$GITHUB_OUTPUT" | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }} | |
| - name: Comment preview URL | |
| if: github.event_name == 'pull_request' && steps.deploy.outputs.url | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| with: | |
| header: preview | |
| message: | | |
| 🔗 Preview: ${{ steps.deploy.outputs.url }} |