[chore]: bump go version to v1.26.4 #89
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 and Preview Site | |
| on: | |
| pull_request_target: | |
| branches: [master] | |
| types: [opened, synchronize, reopened, closed] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| concurrency: | |
| group: preview-${{ github.event.pull_request.number || github.run_id }} | |
| cancel-in-progress: true | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| build-and-deploy-preview: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout PR code | |
| if: github.event.action != 'closed' | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| persist-credentials: false | |
| fetch-depth: 0 | |
| - name: Checkout for cleanup | |
| if: github.event.action == 'closed' | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: gh-pages | |
| fetch-depth: 0 | |
| - name: Setup Go | |
| if: github.event.action != 'closed' | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Setup Hugo Extended | |
| if: github.event.action != 'closed' | |
| uses: peaceiris/actions-hugo@v3 | |
| with: | |
| hugo-version: '0.158.0' | |
| extended: true | |
| - name: Setup Node | |
| if: github.event.action != 'closed' | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Setup site dependencies | |
| if: github.event.action != 'closed' | |
| run: make setup | |
| # The GitHub Pages preview URL is a per-PR subpath, so it is passed here | |
| # directly rather than via the standardized scripts (whose build:preview | |
| # targets Netlify's DEPLOY_PRIME_URL, not GitHub Pages). | |
| # Mirrors 'npm run build:preview' (hugo --cleanDestinationDir -e dev -DFE --minify). | |
| - name: Build PR preview | |
| if: github.event.action != 'closed' | |
| run: | | |
| PR_BASE_URL="https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr-preview/pr-${{ github.event.pull_request.number }}/" | |
| hugo --cleanDestinationDir -e dev -DFE --minify --baseURL "${PR_BASE_URL}" | |
| touch public/.nojekyll | |
| # Preview URLs are public GitHub Pages. Mark the whole deployment | |
| # non-indexable so search engines don't crawl preview content. | |
| - name: Make preview non-indexable | |
| if: github.event.action != 'closed' | |
| run: | | |
| printf 'User-agent: *\nDisallow: /\n' > public/robots.txt | |
| find public -name '*.html' -exec perl -0pi -e 's|<meta name=robots content="index, follow">|<meta name=robots content="noindex, nofollow">|g; s|<meta name="robots" content="index, follow">|<meta name="robots" content="noindex, nofollow">|g; s|</head>|<meta name="robots" content="noindex, nofollow"></head>|i unless /<meta[^>]+name="?robots"?[^>]+noindex, nofollow/i' {} + | |
| - name: Deploy PR preview | |
| if: github.event.action != 'closed' | |
| uses: rossjrw/pr-preview-action@v1.6.3 | |
| with: | |
| source-dir: ./public | |
| preview-branch: gh-pages | |
| umbrella-dir: pr-preview | |
| action: auto | |
| comment: false | |
| - name: Comment PR with Preview URL | |
| if: github.event.action != 'closed' | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| with: | |
| header: pr-preview | |
| message: | | |
| 🚀 Preview deployment: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr-preview/pr-${{ github.event.pull_request.number }}/ | |
| > *Note: Preview may take a moment (GitHub Pages deployment in progress). Please wait and refresh. Track deployment [here](https://github.com/${{ github.repository }}/actions/workflows/pages/pages-build-deployment)* | |
| - name: Cleanup PR preview on close | |
| if: github.event.action == 'closed' | |
| uses: rossjrw/pr-preview-action@v1.6.3 | |
| with: | |
| preview-branch: gh-pages | |
| umbrella-dir: pr-preview | |
| action: remove |