This action is used to deploy Actions artifacts to GitHub Pages.
See action.yml for the various inputs
this action supports.
For examples that make use of this action, check out our starter-workflows in a variety of frameworks.
This action expects an artifact named github-pages
to have been created prior to execution. This is done automatically using actions/upload-pages-artifact
.
We recommend this action to be used in a dedicated job:
jobs:
# Build job
build:
# <Not provided for brevity>
# At a minimum this job should upload artifacts using actions/upload-pages-artifact
# Deploy job
deploy:
# Add a dependency to the build job
needs: build
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
There are a few important considerations to be aware of:
-
The artifact being deployed must have been uploaded in a previous step, either in the same job or a separate job that doesn't execute until the upload is complete.
-
The job that executes the deployment must at minimum have the following permissions:
pages: write
id-token: write
-
The deployment should target the
github-pages
environment (you may use a different environment name if needed, but this is not recommended.) -
If your Pages site is using a source branch, the deployment must originate from this source branch unless your environment is protected in which case the environment protection rules take precedence over the source branch rule
-
If your Pages site is using GitHub Actions as the source, while not required we highly recommend you also protect your environment (we do it by default for you)
In order to release a new version of this Action:
-
Locate the semantic version of the upcoming release (a draft is maintained by the
draft-release
workflow). -
Publish the draft release from the
main
branch with semantic version as the tag name, with the checkbox to publish to the GitHub Marketplace checked. ☑️ -
After publishing the release, the
release
workflow will automatically run to create/update the corresponding the major version tag such asv1
.⚠️ Environment approval is required. Check the Release workflow run list.
The scripts and documentation in this project are released under the MIT License.