7.3 KiB
title, intro, redirect_from, product, permissions, versions, topics, shortTitle
| title | intro | redirect_from | product | permissions | versions | topics | shortTitle | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Configuring a publishing source for your GitHub Pages site | {% ifversion pages-custom-workflow %}You can configure your {% data variables.product.prodname_pages %} site to publish when changes are pushed to a specific branch, or you can write a {% data variables.product.prodname_actions %} workflow to publish your site.{% else%}If you use the default publishing source for your {% data variables.product.prodname_pages %} site, your site will publish automatically. You can also choose to publish your site from a different branch or folder.{% endif %} |
|
{% data reusables.gated-features.pages %} | People with admin or maintainer permissions for a repository can configure a publishing source for a {% data variables.product.prodname_pages %} site. |
|
|
Configure publishing source |
About publishing sources
{% data reusables.pages.pages-about-publishing-source %}
{% data reusables.pages.private_pages_are_public_warning %}
Publishing from a branch
-
Make sure the branch you want to use as your publishing source already exists in your repository. {% data reusables.pages.navigate-site-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.pages.sidebar-pages %} {% ifversion pages-custom-workflow %}
-
Under "Build and deployment", under "Source", select Deploy from a branch.
-
Under "Build and deployment", under "Branch", use the None or Branch drop-down menu and select a publishing source.
-
Under "{% data variables.product.prodname_pages %}", use the None or Branch drop-down menu and select a publishing source.
{% endif %} -
Optionally, use the drop-down menu to select a folder for your publishing source.

Troubleshooting publishing from a branch
{% data reusables.pages.admin-must-push %}
If you choose the docs folder on any branch as your publishing source, then later remove the /docs folder from that branch in your repository, your site won't build and you'll get a page build error message for a missing /docs folder. For more information, see "Troubleshooting Jekyll build errors for {% data variables.product.prodname_pages %} sites."
{% ifversion fpt %}
Your {% data variables.product.prodname_pages %} site will always be deployed with a {% data variables.product.prodname_actions %} workflow run, even if you've configured your {% data variables.product.prodname_pages %} site to be built using a different CI tool. Most external CI workflows "deploy" to GitHub Pages by committing the build output to the gh-pages branch of the repository, and typically include a .nojekyll file. When this happens, the {% data variables.product.prodname_actions %} workflow will detect the state that the branch does not need a build step, and will execute only the steps necessary to deploy the site to {% data variables.product.prodname_pages %} servers.
To find potential errors with either the build or deployment, you can check the workflow run for your {% data variables.product.prodname_pages %} site by reviewing your repository's workflow runs. For more information, see "Viewing workflow run history." For more information about how to re-run the workflow in case of an error, see "Re-running workflows and jobs."
{% note %}
{% data reusables.pages.pages-builds-with-github-actions-public-beta %}
{% endnote %}
{% endif %}
{% ifversion pages-custom-workflow %}
Publishing with a custom {% data variables.product.prodname_actions %} workflow
{% data reusables.pages.pages-custom-workflow-beta %}
When you configure your site to publish with {% data variables.product.prodname_actions %}, {% data variables.product.product_name %} will suggest starter workflows for common publishing scenarios. The general flow of a workflow is to:
- Use the
actions/checkoutaction to check out the repository contents. - If required by your site, build any static site files.
- Use the
actions/upload-pages-artifactaction to upload the static files as an artifact. - Use the
actions/deploy-pagesaction to deploy the artifact.
{% note %}
Note: By default, the starter workflows use a deployment environment called github-pages. This environment has a protection rule that restricts what branches can be deployed to the environment. Although you can change the environment name or protection rules, this is not recommended.
{% endnote %}
{% note %}
Note: A CNAME file in your repository file does not automatically add or remove a custom domain. Instead, you must configure the custom domain through your repository settings or through the API. For more information, see "Managing a custom domain for your GitHub Pages site" and the Pages API reference documentation.
{% endnote %}
To configure your site to publish with {% data variables.product.prodname_actions %}:
{% data reusables.pages.navigate-site-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.pages.sidebar-pages %}
-
Under "Build and deployment", under "Source", select GitHub Actions.
-
{% data variables.product.product_name %} will suggest several starter workflows. If you already have a workflow to publish your site, you can skip this step. Otherwise, choose one of the options to create a {% data variables.product.prodname_actions %} workflow. For more information about {% data variables.product.prodname_actions %}, see "{% data variables.product.prodname_actions %}."
{% data variables.product.prodname_pages %} does not associate a specific workflow to the {% data variables.product.prodname_pages %} settings. However, the {% data variables.product.prodname_pages %} settings will link to the workflow run that most recently deployed your site.
Troubleshooting publishing with a custom {% data variables.product.prodname_actions %} workflow
For information about how to troubleshoot your {% data variables.product.prodname_actions %} workflow, see "About monitoring and troubleshooting."
{% endif %}
