Deployment WorkflowsLesson 4.2
How to deploy to GitHub Pages using GitHub Actions
actions/deploy-pages, actions/configure-pages, pages permission, github-pages environment, artifact upload for pages, static site deployment
GitHub Pages CI Deployment
GitHub Pages hosts static sites for free. GitHub's official Actions automate the build and deployment cycle so every push to main updates your live site.
Complete Pages Workflow
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/configure-pages@v5
- run: npm ci && npm run build
- uses: actions/upload-pages-artifact@v3
with:
path: dist/
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deploy
uses: actions/deploy-pages@v4Three permissions are required: pages: write for deployment, id-token: write for OIDC authentication with Pages, and contents: read to check out code. The url field in the environment block displays the live URL in the GitHub Actions run summary after deployment.
