Skip to content

Use actions/deploy-pages to deploy mdbook output#3419

Merged
Mark-Simulacrum merged 1 commit intorust-lang:masterfrom
Turbo87:github-deploy
Apr 29, 2023
Merged

Use actions/deploy-pages to deploy mdbook output#3419
Mark-Simulacrum merged 1 commit intorust-lang:masterfrom
Turbo87:github-deploy

Conversation

@Turbo87
Copy link
Copy Markdown
Member

@Turbo87 Turbo87 commented Apr 18, 2023

GitHub has official support for deploying to GitHub Pages from a GitHub Actions workflow, without having to deal with special git branches.

This is accomplished by using https://github.com/actions/upload-pages-artifact and https://github.com/actions/deploy-pages. The first action is creating a build artifact from the generated /book folder, while the second one is deploying that artifact to the GitHub Pages environment.

For this to work, the "Pages" settings of the repository will have to be changed:

Bildschirm­foto 2023-04-18 um 13 44 45

We are already using a similar setup for the crates.io ops guide, and it has been working without any issues for us. As a future second step we could even enable the build job to run for PRs too, and only restrict the deploy job to the master branch.

/cc @rust-lang/infra

@Turbo87
Copy link
Copy Markdown
Member Author

Turbo87 commented Apr 18, 2023

Disclaimer: Due to the branch restrictions I could not test this, but as I mentioned above, we have been using a similar setup for the crates.io ops guide without any problems.

@ehuss ehuss added the not-rfc For PRs that fix things like spelling mistakes, wrong file names, etc. label Apr 18, 2023
@Turbo87
Copy link
Copy Markdown
Member Author

Turbo87 commented Apr 28, 2023

@rust-lang/infra any thoughts on this?

@Mark-Simulacrum Mark-Simulacrum merged commit ef26c15 into rust-lang:master Apr 29, 2023
@Turbo87 Turbo87 deleted the github-deploy branch April 30, 2023 05:37
pull Bot pushed a commit to johnperez416/cargo that referenced this pull request Apr 20, 2026
…loyment (rust-lang#16876)

This replaces the `gh-pages` git branch deployment with the official
`actions/upload-pages-artifact` and `actions/deploy-pages` actions.

It requires changing the repository's Pages settings from "Deploy from a
branch" to "GitHub Actions" as described also in
rust-lang/rfcs#3419, which has used a similar
setup for a while now.

I've tested the `build` job in my forked repo and verified that the
artifact contents match the current content of the `gh-pages` branch. I
did not test the `deploy` job with my fork repo, but since it is the
same as in e.g. the `rfcs` repo I don't expect any issues from that.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

not-rfc For PRs that fix things like spelling mistakes, wrong file names, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants