Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions repo_scaffold/templates/template-python/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"description": "A short description of the project.",
"min_python_version": ["3.8", "3.9", "3.10", "3.11"],
"max_python_version": ["3.12"],
"use_mkdocs": ["yes", "no"],
"use_docker": ["yes", "no"],
"include_cli": ["yes", "no"],
"use_github_actions": ["yes", "no"],
Expand All @@ -20,7 +19,6 @@
"description": "项目简短描述",
"min_python_version": "最低支持的 Python 版本 (这将影响测试范围和依赖兼容性)",
"max_python_version": "最高支持的 Python 版本",
"use_mkdocs": "是否使用 MkDocs 生成文档?",
"use_docker": "是否添加 Docker 支持?",
"include_cli": "是否添加命令行界面?",
"use_github_actions": "是否添加 GitHub Actions 支持?"
Expand Down
29 changes: 4 additions & 25 deletions repo_scaffold/templates/template-python/hooks/post_gen_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,10 @@ def remove_cli():

def remove_github_actions():
"""Remove GitHub Actions configuration if not needed."""
github_dir = os.path.join("{{cookiecutter.project_slug}}", ".github")
if os.path.exists(github_dir):
shutil.rmtree(github_dir)


def remove_mkdocs():
"""Remove MkDocs related files if not needed."""
files_to_remove = [
"mkdocs.yml",
os.path.join("docs"),
]
for file in files_to_remove:
path = os.path.join("{{cookiecutter.project_slug}}", file)
if os.path.exists(path):
if os.path.isdir(path):
shutil.rmtree(path)
else:
os.remove(path)
if "{{cookiecutter.use_github_actions}}" == "no":
github_dir = os.path.join(".github")
if os.path.exists(github_dir):
shutil.rmtree(github_dir)


def init_project_depends():
Expand All @@ -39,10 +25,6 @@ def init_project_depends():

# 安装基础开发依赖
subprocess.run(["uv", "sync", "--extra", "dev"], check=True)

# 如果启用了文档功能,安装文档依赖
if "{{cookiecutter.use_mkdocs}}" == "yes":
subprocess.run(["uv", "sync", "--extra", "docs"], check=True)


if __name__ == "__main__":
Expand All @@ -52,7 +34,4 @@ def init_project_depends():
if "{{cookiecutter.use_github_actions}}" == "no":
remove_github_actions()

if "{{cookiecutter.use_mkdocs}}" == "no":
remove_mkdocs()

init_project_depends()
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ jobs:
with:
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
OP_SERVICE_ACCOUNT_TOKEN: {% raw %}${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}{% endraw %}
PERSONAL_ACCESS_TOKEN: op://shawndengdev/github_access_token/credential

- name: Check out
uses: actions/checkout@v4
with:
fetch-depth: 0
token: '${{ env.PERSONAL_ACCESS_TOKEN }}'
token: {% raw %}'${{ env.PERSONAL_ACCESS_TOKEN }}'{% endraw %}

- name: Create bump and changelog
uses: commitizen-tools/commitizen-action@master
with:
github_token: ${{ env.PERSONAL_ACCESS_TOKEN }}
github_token: {% raw %}${{ env.PERSONAL_ACCESS_TOKEN }}{% endraw %}
branch: master
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{% if cookiecutter.use_mkdocs == "yes" %}
name: Deploy Docs

on:
Expand Down Expand Up @@ -31,6 +30,4 @@ jobs:
- name: Build and deploy documentation
run: uv run mkdocs gh-deploy --force
env:
GITHUB_TOKEN: ${{ github.token }}

{% endif %}
GITHUB_TOKEN: {% raw %}${{ github.token }}{% endraw %}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
install-deps: dev
python-version: "{{cookiecutter.max_python_version}}" # 使用最新版本
secrets:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
OP_SERVICE_ACCOUNT_TOKEN: {% raw %}${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}{% endraw %}
PERSONAL_ACCESS_TOKEN: {% raw %}${{ secrets.PERSONAL_ACCESS_TOKEN }}{% endraw %}

lint:
needs: setup
Expand Down Expand Up @@ -82,14 +82,6 @@ jobs:
run: uv tool run nox -s test_all
continue-on-error: true

- name: Upload coverage reports
if: success()
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests

- name: Comment on PR
if: github.event_name == 'pull_request' && steps.test.outcome == 'failure'
uses: actions/github-script@v7
Expand Down

This file was deleted.

This file was deleted.