|
7 | 7 | _EXIT_SUCCESS = 0 |
8 | 8 |
|
9 | 9 |
|
10 | | -def main(initialise_git_repository: str) -> int: |
| 10 | +def main(initialise_git_repository: str, deploy_docs_to_github_pages: str) -> int: |
11 | 11 | """ |
12 | 12 | Create a git repository on generation of the project. |
13 | 13 |
|
14 | 14 | Args: |
15 | 15 | initialise_git_repository: Whether to initialise the repo |
| 16 | + deploy_docs_to_github_pages: Whether to deploy built docs to GitHub Pages |
16 | 17 |
|
17 | 18 | Returns: |
18 | 19 | The return code of the process |
@@ -83,8 +84,30 @@ def main(initialise_git_repository: str) -> int: |
83 | 84 | # some other error |
84 | 85 | print(f"There was an error with the GitHub CLI: {e.returncode}\n{e.stderr}") |
85 | 86 | return _EXIT_FAILURE |
| 87 | + if deploy_docs_to_github_pages == "True": |
| 88 | + print( |
| 89 | + "The 'Documentation' GitHub Actions workflow has been set up to push the " |
| 90 | + "built HTML documentation to a branch gh-pages on pushes to main for " |
| 91 | + "deploying as a GitHub Pages website. To allow the GitHub Actions bot to " |
| 92 | + "push to the gh-pages branch you need to enable 'Read and write " |
| 93 | + "permissions' under 'Workflow permissions' at\n\n" |
| 94 | + "{{cookiecutter.__repo_url}}/settings/actions\n\n" |
| 95 | + "After the 'Documentation' workflow has successfully completed at least " |
| 96 | + "once you will also need to configure the repository to deploy a GitHub " |
| 97 | + "pages site from the content on the gh-pages branch by going to\n\n" |
| 98 | + "{{cookiecutter.__repo_url}}/settings/pages\n\n" |
| 99 | + "and under 'Built and deployment' selecting 'Deploy from a branch' for " |
| 100 | + "the 'Source' drop-down and 'gh-pages' for the 'Branch' drop-down, " |
| 101 | + "leaving the branch path drop-down with its default value of '/ (root)'." |
| 102 | + ) |
| 103 | + |
86 | 104 | return _EXIT_SUCCESS |
87 | 105 |
|
88 | 106 |
|
89 | 107 | if __name__ == "__main__": |
90 | | - sys.exit(main("{{ cookiecutter.initialise_git_repository }}")) |
| 108 | + sys.exit( |
| 109 | + main( |
| 110 | + "{{ cookiecutter.initialise_git_repository }}", |
| 111 | + "{{ cookiecutter.deploy_docs_to_github_pages }}", |
| 112 | + ) |
| 113 | + ) |
0 commit comments