Add PNPM setup step to release workflow #2
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 Release | |
| # yamllint disable-line rule:truthy | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| # hugo reference: https://gohugo.io/host-and-deploy/host-on-github-pages/ | |
| jobs: | |
| build-and-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| env: | |
| # Define tool versions | |
| HUGO_VERSION: 0.164.0 | |
| PNPM_VERSION: 11.14 | |
| NODE_VERSION: 24.18.0 | |
| steps: | |
| - name: π₯ Checkout repository | |
| uses: actions/checkout@v7 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| lfs: false | |
| - name: π¦ Setup pnpm | |
| uses: pnpm/action-setup@v6 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - name: π© Install Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: "pnpm" | |
| - name: ποΈ Install Hugo | |
| run: | | |
| echo "Installing Hugo ${HUGO_VERSION}..." | |
| HUGO_BASE="https://github.com/gohugoio/hugo/releases" | |
| HUGO_FILE="hugo_${HUGO_VERSION}_linux-amd64.tar.gz" | |
| curl -sfL --output-dir "${{ runner.temp }}" \ | |
| -O "${HUGO_BASE}/download/v${HUGO_VERSION}/${HUGO_FILE}" | |
| mkdir "${HOME}/.local/hugo" | |
| tar -C "${HOME}/.local/hugo" \ | |
| -xf "${{ runner.temp }}/${HUGO_FILE}" | |
| echo "${HOME}/.local/hugo" >> "${GITHUB_PATH}" | |
| - name: π Log tool versions | |
| run: | | |
| echo "Logging tool versions..." | |
| command -v hugo &> /dev/null \ | |
| && echo "Hugo: $(hugo version)" \ | |
| || echo "Hugo: not installed" | |
| command -v node &> /dev/null \ | |
| && echo "Node.js: $(node --version)" \ | |
| || echo "Node.js: not installed" | |
| - name: π¨ Install CSS dependencies and build CSS | |
| working-directory: src/themes/tailbliss | |
| run: | | |
| pnpm install | |
| pnpm run build:css | |
| - name: β»οΈ Cache restore | |
| id: cache-restore | |
| uses: actions/cache/restore@v6 | |
| with: | |
| path: ${{ runner.temp }}/.cache/hugo | |
| key: hugo-${{ github.run_id }} | |
| restore-keys: hugo- | |
| - name: π Copy built CSS to static directory | |
| working-directory: src | |
| run: cp themes/tailbliss/static/css/main.*.css static/css/ | |
| - name: π Build Hugo (production) | |
| working-directory: src | |
| run: | | |
| echo "Building the project..." | |
| hugo build \ | |
| --gc \ | |
| --minify \ | |
| --cacheDir "${{ runner.temp }}/.cache/hugo" | |
| - name: πΎ Cache save | |
| uses: actions/cache/save@v6 | |
| with: | |
| path: ${{ runner.temp }}/.cache/hugo | |
| key: ${{ steps.cache-restore.outputs.cache-primary-key }} | |
| - name: π¦ Create release archive | |
| run: tar -czf website-${{ github.ref_name }}.tar.gz -C src/public . | |
| - name: π Create GitHub Release | |
| # yamllint disable-next-line rule:line-length | |
| uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2 | |
| with: | |
| files: website-${{ github.ref_name }}.tar.gz | |
| generate_release_notes: true |