Skip to content

Commit a13c78a

Browse files
🐞 fix: 调整repo.sh中初始化顺序
必须要建立repo,然后才能设置secrets
1 parent c7d28f9 commit a13c78a

6 files changed

Lines changed: 27 additions & 26 deletions

File tree

.github/workflows/dev.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,10 @@ jobs:
7272
run: |
7373
poetry install -E dev
7474
poetry run mkdocs build
75+
echo "config git user"
7576
git config --global user.name Docs deploy
7677
git config --global user.email docs@dummy.bot.com
78+
echo "run mike deploy"
7779
poetry run mike deploy -p -f "`poetry version --short`.dev"
7880
poetry run mike set-default -p "`poetry version --short`.dev"
7981

docs/history.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
`(#{number})` means an issue of this project. You may check details of the issue by visiting https://github.com/zillionare/python-project-wizard/issues/_{number}_
44

55
## v1.3
6-
* [#23](https://github.com/zillionare/python-project-wizard/issues/23)
7-
* [#24](https://github.com/zillionare/python-project-wizard/issues/24)
6+
* [#23](https://github.com/zillionare/python-project-wizard/issues/23) add email notification upon build success
7+
* [#24](https://github.com/zillionare/python-project-wizard/issues/24) config repo secrets by script
8+
* [#25](https://github.com/zillionare/python-project-wizard/issues/25) support create repo and upload source code
89
## v1.2.2
910
* [#22](https://github.com/zillionare/python-project-wizard/issues/22) mike deploy failed
1011
## v1.2.1

docs/tutorial.md

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ This will give you a test report and a lint report. You should see no errors exc
155155

156156
The script looks like the following:
157157
```
158+
# uncomment the following to create repo and push code to github
159+
# git add .
160+
# git commit -m "Initial commit by ppw"
161+
# gh repo create {{cookiecutter.project_slug}} --public -s . --push
162+
158163
# Uncomment the following to config github secret used by github workflow.
159164
# gh secret set PERSONAL_TOKEN --body $GH_TOKEN
160165
# gh secret set PYPI_API_TOKEN --body $PYPI_API_TOKEN
@@ -165,11 +170,6 @@ This will give you a test report and a lint report. You should see no errors exc
165170
# gh secret set BUILD_NOTIFY_MAIL_FROM --body $BUILD_NOTIFY_MAIL_FROM
166171
# gh secret set BUILD_NOTIFY_MAIL_PASSWORD --body $BUILD_NOTIFY_MAIL_PASSWORD
167172
# gh secret set BUILD_NOTIFY_MAIL_RCPT --body $BUILD_NOTIFY_MAIL_RCPT
168-
169-
# uncomment the following to create repo and push code to github
170-
# git add ./{{cookiecutter.project_slug}}
171-
# git commit -m "Initial commit by ppw"
172-
# gh repo create your_repo --public -s ./path/to/source --push
173173
```
174174
before launch the script, you will need to apply github personal token and set environment variable GH_TOKEN beforehand. And you need install the tool [**gh**](https://cli.github.com/) too.
175175

@@ -225,7 +225,7 @@ In your browser, visit [install codecov app], you'll be landed at this page:
225225
Click on the green `install` button at top right, choose `all repositories` then click
226226
on `install` button, following directions until all sets.
227227

228-
### Step 9: Check the CI result
228+
## Step 9: Check the CI result
229229

230230
After pushing your code to github, go to github web page, navigate to your repo, then
231231
click on actions link, you should find screen like this:
@@ -237,28 +237,25 @@ new artifact is published under the name {{ cookiecutter.project_slug }}
237237

238238
## Step 10. Check the documentation
239239

240-
Documentation will be published and available at
241-
<https://{your_github_account}.github.io/{your_repo}> once:
240+
Documentation will be published and available at <https://{your_github_account}.github.io/{your_repo}> once:
242241

243242
1. the branch is either main or master
244243
2. the commit is tagged, and the tag name is started with 'v' (lower case)
245244
3. build/testing executed by github CI passed
246245

247-
If you'd like to see what it looks like now, you could run the followng command:
246+
If you'd like to see what it looks like now, you could run the followng command:
248247

249248
```
250249
mkdocs gh-deploy
251250
```
252251

253-
then check your documentation at <https://{your_github_account}.github.io/{your_repo}>
254-
255-
or you can serve it locally by:
252+
then check your documentation at <https://{your_github_account}.github.io/{your_repo}> or you can serve it locally by:
256253

257254
```
258255
mkdocs serve -a 0.0.0.0:8000
259256
```
260257

261-
then open your browser, visit your dev machine on port 8000.
258+
then open your browser, visit your dev machine on port 8000.
262259

263260
???+ Info
264261
Though we used mkdocs here, however, in order to support multiple versions of documentation, we actually use mike in github actions.
@@ -272,7 +269,7 @@ new artifact is published under the name {{ cookiecutter.project_slug }}
272269

273270
## Step 11. Make an official release
274271

275-
After done with your phased development, switch to either of (main, master) branch, following instructions at [release checklist](/python-project-wizard/pypi_release_checklist), trigger first official release and check result at [PYPI].
272+
After done with your phased development, switch to either of (main, master) branch, following instructions at [release checklist](/pypi_release_checklist), trigger first official release and check result at [PYPI].
276273

277274
## Step 12. Customization
278275

hooks/post_gen_project.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def init_dev():
5858
print(Style.RESET_ALL, Style.DIM)
5959
try:
6060
execute(sys.executable, "-m", "pip", "install", "pre-commit")
61-
execute("pre-commit", "install")
61+
execute("pre-commit", "install", cwd=PROJECT_DIRECTORY)
6262
print(Style.NORMAL, Fore.GREEN, "pre-commit hooks was successfully installed")
6363
print(Style.RESET_ALL)
6464
except Exception as e:
@@ -87,7 +87,7 @@ def init_dev():
8787
try:
8888
print(Style.NORMAL, Fore.BLUE, "install all dev dependency packages...")
8989
print(Style.RESET_ALL, Style.DIM)
90-
execute("poetry", "install", "-E", "dev", "-E", "doc", "-E", "test")
90+
execute("poetry", "install", "-E", "dev", "-E", "doc", "-E", "test", cwd=PROJECT_DIRECTORY)
9191
print(
9292
Style.NORMAL,
9393
Fore.GREEN,
@@ -106,7 +106,7 @@ def init_dev():
106106
try:
107107
print(Style.NORMAL, Fore.BLUE, "lint files...")
108108
print(Style.RESET_ALL, Style.DIM)
109-
execute("pre-commit", "run", "--all")
109+
execute("pre-commit", "run", "--all", cwd=PROJECT_DIRECTORY)
110110
print(
111111
Style.NORMAL,
112112
Fore.GREEN,

repo.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ gh secret set BUILD_NOTIFY_MAIL_SERVER --body $BUILD_NOTIFY_MAIL_SERVER
1313
gh secret set BUILD_NOTIFY_MAIL_FROM --body $BUILD_NOTIFY_MAIL_FROM
1414
gh secret set BUILD_NOTIFY_MAIL_PASSWORD --body $BUILD_NOTIFY_MAIL_PASSWORD
1515
gh secret set BUILD_NOTIFY_MAIL_RCPT --body $BUILD_NOTIFY_MAIL_RCPT
16-
gh secret set DINGTALK_ACCESS_TOKEN --body $DINGTALK_ACCESS_TOKEN
17-
gh secret set DINGTALK_SECRET --body $DINGTALK_SECRET
16+
gh secret set DINGTALK_ACCESS_TOKEN --body $BUILD_DINGTALK_ACCESS_TOKEN
17+
gh secret set DINGTALK_SECRET --body $BUILD_DINGTALK_SECRET
1818

1919
# uncomment the following to create repo and push code to github
2020
# git add ./{{cookiecutter.project_slug}}

{{cookiecutter.project_slug}}/repo.sh

100644100755
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
#!/bin/bash
22

3+
# !!!NOTICE!!
34
# Personal token with full access rights is required to run this scripts
45
# Once you got persona token, set enviroment variable GH_TOKEN with it
56

7+
# uncomment the following to create repo and push code to github
8+
# git add .
9+
# git commit -m "Initial commit by ppw"
10+
# gh repo create {{cookiecutter.project_slug}} --public -s . --push
11+
612
# Uncomment the following to config github secret used by github workflow.
713
# gh secret set PERSONAL_TOKEN --body $GH_TOKEN
814
# gh secret set PYPI_API_TOKEN --body $PYPI_API_TOKEN
@@ -13,8 +19,3 @@
1319
# gh secret set BUILD_NOTIFY_MAIL_FROM --body $BUILD_NOTIFY_MAIL_FROM
1420
# gh secret set BUILD_NOTIFY_MAIL_PASSWORD --body $BUILD_NOTIFY_MAIL_PASSWORD
1521
# gh secret set BUILD_NOTIFY_MAIL_RCPT --body $BUILD_NOTIFY_MAIL_RCPT
16-
17-
# uncomment the following to create repo and push code to github
18-
# git add ./{{cookiecutter.project_slug}}
19-
# git commit -m "Initial commit by ppw"
20-
# gh repo create {{cookiecutter.project_slug}} --public -s ./{{cookiecutter.project_slug}} --push

0 commit comments

Comments
 (0)