From cf9c924940a1761f3ba549d41f4ba8e683e54b33 Mon Sep 17 00:00:00 2001 From: colyerdeng Date: Tue, 18 Feb 2025 17:08:02 +0800 Subject: [PATCH] fix: fix template github action --- .../.github/workflows/deploy_docs.yaml | 29 ++++++++++++------- .../.github/workflows/release_build.yaml | 11 ++----- uv.lock | 2 +- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/repo_scaffold/templates/template-python/{{cookiecutter.project_slug}}/.github/workflows/deploy_docs.yaml b/repo_scaffold/templates/template-python/{{cookiecutter.project_slug}}/.github/workflows/deploy_docs.yaml index f104991..8a98dd0 100644 --- a/repo_scaffold/templates/template-python/{{cookiecutter.project_slug}}/.github/workflows/deploy_docs.yaml +++ b/repo_scaffold/templates/template-python/{{cookiecutter.project_slug}}/.github/workflows/deploy_docs.yaml @@ -3,25 +3,34 @@ name: Deploy Docs on: release: - types: [published] # 当 release 发布时触发,而不是创建时 + types: [published] + branches: [main] workflow_dispatch: # 保留手动触发选项 permissions: contents: write # 用于部署到 GitHub Pages jobs: - setup: - uses: ./.github/workflows/setup.yaml - with: - install-deps: docs - secrets: inherit - deploy: - needs: setup runs-on: ubuntu-latest steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: "{{cookiecutter.max_python_version}}" + + - name: Install uv + uses: astral-sh/setup-uv@v5 + + - name: Install dependencies + run: uv sync --extra=docs + - name: Build and deploy documentation - run: uvx mkdocs gh-deploy --force + run: uv run mkdocs gh-deploy --force env: - {% raw %}GITHUB_TOKEN: ${{ needs.setup.outputs.PERSONAL_ACCESS_TOKEN || github.token }}{% endraw %} + GITHUB_TOKEN: ${{ github.token }} + {% endif %} diff --git a/repo_scaffold/templates/template-python/{{cookiecutter.project_slug}}/.github/workflows/release_build.yaml b/repo_scaffold/templates/template-python/{{cookiecutter.project_slug}}/.github/workflows/release_build.yaml index c32ed21..93ac6a1 100644 --- a/repo_scaffold/templates/template-python/{{cookiecutter.project_slug}}/.github/workflows/release_build.yaml +++ b/repo_scaffold/templates/template-python/{{cookiecutter.project_slug}}/.github/workflows/release_build.yaml @@ -1,14 +1,9 @@ -name: release_build +name: release-build on: -<<<<<<< HEAD - push: - tags: - - '[0-9]*.[0-9]*.[0-9]*' # 匹配语义化版本号标签 (e.g., 1.0.0, 1.0.0-beta) -======= release: - types: [published] # 当 release 发布时触发,而不是创建时 ->>>>>>> Ci/update-github-action + types: [published] + branches: [main] workflow_dispatch: inputs: version: diff --git a/uv.lock b/uv.lock index 90d3810..567ceb3 100644 --- a/uv.lock +++ b/uv.lock @@ -778,7 +778,7 @@ wheels = [ [[package]] name = "repo-scaffold" -version = "0.5.2" +version = "0.5.3" source = { editable = "." } dependencies = [ { name = "click" },