|
18 | 18 |
|
19 | 19 |
|
20 | 20 | # ---------------------------------------------------------------------- |
21 | | -_prompts: dict[str, str] = { |
| 21 | +_prefix_prompts: dict[str, str] = { |
22 | 22 | "GitHub Personal Access Token for gists": textwrap.dedent( |
23 | 23 | """\ |
24 | | - In this step, we will create a GitHub Personal Access Token (PAT) that is used to |
25 | | - update the gist that stores dynamic build data. |
| 24 | + In this step, we will create a GitHub Personal Access Token (PAT) that is used to update the gist that stores dynamic build data. |
26 | 25 |
|
27 | 26 | 1. Visit {{ cookiecutter.github_url }}/settings/tokens?type=beta |
28 | 27 | 2. Click the "Generate new token" button |
|
54 | 53 | ), |
55 | 54 | "Temporary PyPi Token to Publish Packages": textwrap.dedent( |
56 | 55 | """\ |
57 | | - In this step, we will create a PyPi token that is used to publish python packages. Note |
58 | | - that this token will be scoped to all of your projects on PyPi. Once the package is |
59 | | - published for the first time, we will delete this token and create one that is scoped to |
60 | | - a single project. |
| 56 | + In this step, we will create a PyPi token that is used to publish python packages. Note that this token will be scoped to all of your projects on PyPi. Once the package is published for the first time, we will delete this token and create one that is scoped to a single project. |
61 | 57 |
|
62 | 58 | 1. Visit https://pypi.org/manage/account/ |
63 | 59 | 2. Click the "Add API token" button |
64 | 60 | 3. Enter the values: |
65 | | - Token name: "Temporary GitHub Publish Action ({{ cookiecutter.github_project_name }})" |
66 | | - Scope: "Entire account (all projects)" |
| 61 | + Token name: Temporary GitHub Publish Action ({{ cookiecutter.github_project_name }}) |
| 62 | + Scope: Entire account (all projects) |
67 | 63 | 4. Click the "Create token" button |
68 | 64 | 5. Click the "Copy token" button for use in the next step |
69 | 65 | """, |
|
81 | 77 | 5. Click the "Add secret" button |
82 | 78 | """, |
83 | 79 | ), |
84 | | - "Commit and Push the Repository": textwrap.dedent( |
| 80 | +} |
| 81 | + |
| 82 | +if {{cookiecutter.create_docker_image}}: |
| 83 | + _prefix_prompts["Update GitHub Seettings"] = textwrap.dedent( |
85 | 84 | """\ |
86 | | - In this step, we commit the files generated in git, push the changes in GitHub, and verify |
87 | | - that the GitHub Actions workflow ran successfully. |
| 85 | + In this step, we will update GitHub settings to allow pushing the generated docker image to the GitHub Container Registry during the build. |
| 86 | +
|
| 87 | + 1. Visit {{ cookiecutter.github_url }}/{{ cookiecutter.github_username }}/{{ cookiecutter.github_project_name }}/settings/actions |
| 88 | + 2. In the "Workflow permissions" section... |
| 89 | + 3. Select "Read and write permissions" |
| 90 | + 4. Click the "Save" button |
| 91 | + """, |
| 92 | + ) |
88 | 93 |
|
89 | | - Commit and Push the Changes |
90 | | - --------------------------- |
91 | | - Note that these steps assume that the GitHub repository has already been created. |
| 94 | +_prompts: dict[str, str] = { |
| 95 | + "Commit and Push the Repository": textwrap.dedent( |
| 96 | + """\ |
| 97 | + In this step, we commit the files generated in git and push the changes to GitHub. Note that these steps assume that the GitHub repository has already been created. |
92 | 98 |
|
93 | 99 | From a terminal: |
94 | 100 |
|
95 | 101 | 1. Run 'git add -all' |
96 | 102 | {windows_command}{commit_step_num}. Run 'git commit -m "🎉 Initial commit"' |
97 | 103 | {push_step_num}. Run 'git push' |
98 | | -
|
99 | | - Verify the GitHub Actions Workflow |
100 | | - ---------------------------------- |
101 | | - 1. Visit {{ cookiecutter.github_url }}/{{ cookiecutter.github_username }}/{{ cookiecutter.github_project_name }}/actions |
102 | | - 2. Click on the most recent workflow |
103 | | - 3. Wait for the workflow to complete |
104 | 104 | """, |
105 | 105 | ).format( |
106 | 106 | windows_command=( |
107 | | - "2. git update-index --chmod=+x Bootstrap.sh\n" if os.name == "nt" else "" |
| 107 | + "2. Run 'git update-index --chmod=+x Bootstrap.sh'\n" if os.name == "nt" else "" |
108 | 108 | ), |
109 | 109 | commit_step_num="3" if os.name == "nt" else "2", |
110 | 110 | push_step_num="4" if os.name == "nt" else "3", |
111 | 111 | ), |
| 112 | + "Verify GitHub Actions": textwrap.dedent( |
| 113 | + """\ |
| 114 | + In this step, we will verify that the GitHub Action workflows ran successfully. |
| 115 | +
|
| 116 | + 1. Visit {{ cookiecutter.github_url }}/{{ cookiecutter.github_username }}/{{ cookiecutter.github_project_name }}/actions |
| 117 | + 2. Click on the most recent workflow |
| 118 | + 3. Wait for the workflow to complete |
| 119 | + """, |
| 120 | + ), |
112 | 121 | "Remove Temporary PyPi Token": textwrap.dedent( |
113 | 122 | """\ |
114 | | - In this step, we will delete the temporary PyPi token previously created. A new token to replace |
115 | | - it will be created in the steps that follow. |
| 123 | + In this step, we will delete the temporary PyPi token previously created. A new token to replace it will be created in the steps that follow. |
116 | 124 |
|
117 | 125 | 1. Visit https://pypi.org/manage/account/ |
118 | 126 | 2. Find the token named "Temporary GitHub Publish Action ({{ cookiecutter.github_project_name }})"... |
|
130 | 138 | 1. Visit https://pypi.org/manage/account/ |
131 | 139 | 2. Click the "Add API token" button |
132 | 140 | 3. Enter the values: |
133 | | - Token name: "GitHub Publish Action ({{ cookiecutter.github_project_name }})" |
134 | | - Scope: "Project: {{ cookiecutter.pypi_project_name }}" |
| 141 | + Token name: GitHub Publish Action ({{ cookiecutter.github_project_name }}) |
| 142 | + Scope: Project: {{ cookiecutter.pypi_project_name }} |
135 | 143 | 4. Click the "Create token" button |
136 | 144 | 5. Click the "Copy token" button for use in the next step |
137 | 145 | """, |
@@ -179,16 +187,20 @@ def UpdateLicenseFile(): |
179 | 187 | # ---------------------------------------------------------------------- |
180 | 188 | def DisplayPrompts(): |
181 | 189 | border_colors = itertools.cycle( |
182 | | - ["green", "yellow", "blue", "magenta", "cyan"], |
| 190 | + ["yellow", "blue", "magenta", "cyan", "green"], |
183 | 191 | ) |
184 | 192 |
|
185 | | - for prompt_index, (title, prompt) in enumerate(_prompts.items()): |
| 193 | + sys.stdout.write("\n\n") |
| 194 | + |
| 195 | + prompts = list(itertools.chain(_prefix_prompts.items(), _prompts.items())) |
| 196 | + |
| 197 | + for prompt_index, (title, prompt) in enumerate(prompts): |
186 | 198 | print( |
187 | 199 | Panel( |
188 | | - prompt.strip(), |
| 200 | + prompt.rstrip(), |
189 | 201 | border_style=next(border_colors), |
190 | 202 | padding=1, |
191 | | - title=f"[{prompt_index + 1}/{len(_prompts)}] {title}", |
| 203 | + title=f"[{prompt_index + 1}/{len(prompts)}] {title}", |
192 | 204 | title_align="left", |
193 | 205 | ), |
194 | 206 | ) |
|
0 commit comments