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 b47ec0e..b894a4b 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,11 +1,9 @@ name: release-build on: - release: - types: [published] - branches: - - main - - master + push: + tags: + - '[0-9]+.[0-9]+.[0-9]+' # 匹配类似 1.0.0, 2.1.3 等格式的标签 workflow_dispatch: inputs: version: @@ -13,13 +11,16 @@ on: required: true type: string + permissions: contents: write # 用于创建 release id-token: write # 用于发布到 PyPI jobs: - build: + release-build: runs-on: ubuntu-latest + permissions: + contents: write # 用于创建 GitHub Release steps: - uses: actions/checkout@v4 @@ -28,7 +29,7 @@ jobs: with: export-env: true env: - {% raw %}OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}{% endraw %} + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} PERSONAL_ACCESS_TOKEN: op://shawndengdev/github_access_token/credential PYPI_TOKEN: op://shawndengdev/pypi_token/credential