chore: standardize repository tooling #18
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: Surge Preview | |
| on: | |
| pull_request: | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| checks: write | |
| jobs: | |
| preview: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 | |
| with: | |
| persist-credentials: false | |
| - name: Check Surge token | |
| id: surge-token | |
| env: | |
| SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} | |
| run: | | |
| if [ -n "$SURGE_TOKEN" ]; then | |
| echo "enabled=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "enabled=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Build preview | |
| if: ${{ steps.surge-token.outputs.enabled == 'true' }} | |
| run: | | |
| npm install | |
| npm run build | |
| - uses: afc163/surge-preview@bf90a5a86111f6311ca42f0a5a0f80fb0fb03cec | |
| if: ${{ steps.surge-token.outputs.enabled == 'true' }} | |
| env: | |
| SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} | |
| with: | |
| surge_token: ${{ env.SURGE_TOKEN }} | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| dist: docs-dist | |
| failOnError: false | |
| setCommitStatus: false | |
| - name: Skip Surge preview | |
| if: ${{ steps.surge-token.outputs.enabled != 'true' }} | |
| run: echo "SURGE_TOKEN is not configured; skip Surge preview." |