You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use actions/deploy-pages to deploy docs in template (#578)
Resolves#561Resolve#574
Switches from the current branch based workflow for deploying MkDocs
documentation to GitHub Pages in template to instead use
`actions/deploy-pages` and removes suggestion in post-generation message
displayed to user to set repository wide write permissions for Github
Actions workflows in favour of using granular permissions in workflow
file.
I originally completely removed the post-generation message as I thought
by using the `actions/deploy-pages` approach we might be able to avoid
having to do additional configuration of repository before site will
deploy, but unfortunately it seems the default source setting for GitHub
Pages on a new repository is branch so unless this is switched to GitHub
Actions before doing the initial workflow run, the deploy job fails. I
couldn't see any options for configuring this via CLI under `gh repo
edit`.
Tested this works at https://github.com/matt-graham/docs-deploy-test and
everything seems to work as expected provided manual configuration steps
are done as indicated in updated message.
Copy file name to clipboardExpand all lines: tutorial.md
+12-28Lines changed: 12 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -189,60 +189,44 @@ When you pushed to `main` you will have triggered runs of the [GitHub actions](h
189
189
You can view the status of the workflow jobs by browsing the `Actions` button at the top bar of the repository homepage, which takes you to `https://github.com/{github_owner}/{project_slug}/actions`.
190
190
191
191
Depending on your account settings, you may find that the `Documentation` workflow shows as failed (❌).
192
-
If you see this it's probably because of the repository permissions settings for GitHub Actions.
192
+
If you see this it's probably because of the repository setting specifying the source for deploying a GitHub pages site from.
193
193
We'll fix this in the next section.
194
194
195
195
For now, have a browse around the GitHub web interface.
196
196
197
197
## 📄 Configuring repository to host docs on GitHub Pages
198
198
199
-
Now that your repository is on GitHub, you need to do a few more steps to set up your project's documentation website.
199
+
Now that your repository is on GitHub, you need to do one more step to set up your project's documentation website.
200
200
The HTML documentation will be built using the `Documentation` workflow (that we're going to fix) and hosted on [GitHub Pages](https://pages.github.com/).
201
201
202
202
If you scroll back in your terminal to the end of the [cookiecutter] questions, you should be able to find a message like:
203
203
204
204
```sh
205
-
The 'Documentation' GitHub Actions workflow has been set up to push the built
206
-
HTML documentation to a branch gh-pages on pushes to main for deploying as a
207
-
GitHub Pages website. To allow the GitHub Actions bot to push to the gh-pages
208
-
branch you need to enable'Read and write permissions' under 'Workflow
209
-
permissions' at
205
+
The 'Documentation' GitHub Actions workflow has been set up to deploy the built
206
+
HTML documentation to a GitHub Pages website on pushes to main.
and under 'Built and deployment' selecting 'Deploy from a branch'for the
220
-
'Source' drop-down and 'gh-pages'for the 'Branch' drop-down, leaving the
221
-
branch path drop-down with its default value of '/ (root)'.
213
+
and under 'Build and deployment' selecting 'GitHub Actions'for'Source'.
222
214
```
223
215
224
216
As before replace `{github_owner}` and `{project_slug}` with the relevant GitHub repository owner and project slug that you chose at the start.
225
217
226
-
The first part of the instructions explains how to set the permissions for GitHub Actions.
227
-
This lets the Actions bot push the built HTML documentation to a branch `gh-pages` when you update the default `main` branch.
218
+
Following tha instructions printed to the terminal, go to `https://github.com/{github_owner}/{project_slug}/settings/pages` and set GitHub Actions as the source for GitHub Pages.
228
219
229
-
- Go to the Actions settings page at the URL above (or via the repository `Settings` tab, then `Actions > General`).
230
-
- Set `Workflow permissions` to `Read and write permissions`.
220
+
- Set `Source` to `GitHub Actions`.
231
221
232
-
Now that the permissions have changed, we need to re-run the `Documentation` workflow.
222
+
Now that the source settings has been changed, we need to re-run the `deploy` job in the `Documentation` workflow.
233
223
234
224
- Go back to the Actions page. Select the Actions button (in the top bar), or visit
- Click on the failing entry for the `Documentation` workflow.
237
-
- Click on the `Re-run all jobs` button (top right of the page).
238
-
239
-
After the `Documentation` workflow finishes, a new `gh-pages` branch will be created containing only the HTML docs.
240
-
241
-
Following tha instructions printed to the terminal, go to `https://github.com/{github_owner}/{project_slug}/settings/pages` and set this branch as the source for GitHub Pages.
242
-
243
-
- Set `Source` to `Deploy from branch` and `Branch` to `gh-pages`.
227
+
- Click on the drop down ▼ symbol next to `Re-run jobs` button (top right of the page) and click `Re-run failed jobs`.
228
+
- Click `Re-run jobs` button in dialogue box which appears which should list the `deploy` job as the failed job to re-run.
244
229
245
-
This will start another new workflow called `pages-build-deployment` (in the Actions page).
0 commit comments