migrate: 親和力(accessibility)章節 #148
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: Build | |
| on: | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| # Triggers the workflow when pull request is opened or updated | |
| pull_request_target: | |
| types: [opened, synchronize, reopened, labeled] | |
| jobs: | |
| build: | |
| # Run this job if the pull request is from the same repository or labeled with 'safe-to-deploy' | |
| if: ${{ github.event.pull_request.head.repo.full_name == github.repository || github.event.label.name == 'safe-to-deploy' || github.event_name == 'workflow_dispatch'}} | |
| runs-on: ubuntu-latest | |
| steps: | |
| # ref: https://github.com/actions/starter-workflows/tree/main/pages | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| - name: Setup Hugo | |
| uses: peaceiris/actions-hugo@v2 | |
| with: | |
| hugo-version: "latest" | |
| extended: true | |
| - name: Build with Hugo | |
| # Outputs to the './public' directory by default | |
| run: | | |
| TARGET_URL="https://storage.googleapis.com/guide-dev/${{ github.run_id }}" | |
| hugo build --minify --baseURL "$TARGET_URL" | |
| - name: Archive production artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: hugo-site | |
| path: ./public | |
| deploy: | |
| needs: build | |
| uses: ./.github/workflows/deploy.yml | |
| permissions: # Required by google-github-actions/auth | |
| contents: "read" | |
| id-token: "write" | |
| with: | |
| RUN_ID: ${{ github.run_id }} | |
| secrets: inherit | |
| comment: # Required by peter-evans/create-or-update-comment@v4 | |
| needs: deploy | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write | |
| steps: | |
| - name: Find Comment | |
| uses: peter-evans/find-comment@v3 | |
| id: fc | |
| with: | |
| issue-number: ${{ github.event.pull_request.number }} | |
| comment-author: "github-actions[bot]" | |
| body-includes: Deployed to | |
| - name: Create or update comment | |
| uses: peter-evans/create-or-update-comment@v4 | |
| with: | |
| comment-id: ${{ steps.fc.outputs.comment-id }} | |
| issue-number: ${{ github.event.pull_request.number }} | |
| body: | | |
| Deployed to https://storage.googleapis.com/guide-dev/${{ github.run_id }}/index.html | |
| edit-mode: replace |