Rename deploy step to publish in workflow #3
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
| --- | |
| # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
| name: Publish | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| HUGO_VERSION: 0.150.0 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - name: Setup Go | |
| uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6 | |
| with: | |
| cache: false | |
| go-version: stable | |
| - name: Setup Node.js | |
| uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5 | |
| with: | |
| node-version: 22.x | |
| - name: Setup Pages | |
| id: pages | |
| uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5 | |
| - name: Create directory for user-specific executable files | |
| run: |- | |
| mkdir -p "${HOME}/.local" | |
| - name: Install Hugo | |
| run: | | |
| curl -sLJO "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz" | |
| mkdir "${HOME}/.local/hugo" | |
| tar -C "${HOME}/.local/hugo" -xf "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz" | |
| rm "hugo_extended_${HUGO_VERSION}_linux-amd64.tar.gz" | |
| echo "${HOME}/.local/hugo" >> "${GITHUB_PATH}" | |
| - name: Verify installations | |
| run: |- | |
| echo "Go: $(go version)" | |
| echo "Hugo: $(hugo version)" | |
| echo "Node.js: $(node --version)" | |
| - name: Install Node.js dependencies | |
| run: |- | |
| [[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true | |
| - name: Configure Git | |
| run: |- | |
| git config core.quotepath false | |
| - name: Cache restore | |
| uses: actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4 | |
| id: cache-restore | |
| with: | |
| key: hugo-${{ github.run_id }} | |
| path: ${{ runner.temp }}/hugo_cache | |
| restore-keys: hugo- | |
| - name: Build the site | |
| run: |- | |
| hugo \ | |
| --gc \ | |
| --minify \ | |
| --baseURL "${{ steps.pages.outputs.base_url }}/" \ | |
| --cacheDir "${{ runner.temp }}/hugo_cache" | |
| - name: Cache save | |
| uses: actions/cache/save@0400d5f644dc74513175e3cd8d07132dd4860809 # v4 | |
| id: cache-save | |
| with: | |
| key: ${{ steps.cache-restore.outputs.cache-primary-key }} | |
| path: ${{ runner.temp }}/hugo_cache | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4 | |
| with: | |
| path: ./public | |
| publish: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build | |
| steps: | |
| - name: Publish to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4 |