PNPM Deployment to GitHub Pages
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 457
- Forks
- 272
- Avg merge
- 13h 33m
- Merged PRs (30d)
- 23
Description
The current example deployment script generates warnings due to the actions using deprecated versions.
I also use pnpm locally, so an example of how to get started with pnpm as well as npm would be nice.
I'm not sure what the preset does in npx nuxt build --preset github_pages and if that's the same as the Nitro preset?
My own static page could be deployed using pnpm generate with this deploy.yaml script:
# https://github.com/actions/deploy-pages#usage
name: Deploy to GitHub Pages
on:
push:
branches: [main]
workflow_dispatch:
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
contents: read
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PNPM
uses: pnpm/action-setup@v3
with:
version: 9.0.x
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
# Pick your own package manager and build script
- name: Install dependencies
run: pnpm install
- name: Build nuxt
run: pnpm generate
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./.output/public
# Deployment job
deploy:
environment:
name: github_pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
I'm hesitant to update the docs with this example myself when I don't fully understand it all yet, but maybe this could be useful as a starter to someone with more knowledge then me (or future me).
I took some inspiration from the Vitepress example, which is why a couple of things have been moved or reformatted slightly.
Edit: remove - run: corepack enable as I don't think its necessary.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the deployment documentation at nuxt.com/deploy/github-pages, then compare its current workflow with the Nitro GitHub Pages provider and the VitePress example linked in the issue. Verify the meaning of the github_pages preset and the proposed pnpm workflow before updating the documentation. Done means deprecated action versions are addressed and both npm and pnpm usage are clearly covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, nuxt
- Domain
- ci-cd, devops, documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100