From 2730e0088a58e670b621cd6159fe62974fe7a93c Mon Sep 17 00:00:00 2001 From: trisdoan Date: Tue, 30 Dec 2025 12:56:02 +0700 Subject: [PATCH 1/2] chore: update release step --- .github/workflows/release.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b89d4a6..55f2015 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,6 +1,9 @@ name: release -on: push +on: + push: + branches: + - main permissions: contents: write From b7518549c99a74423f67d881cb2cd71d6c55205e Mon Sep 17 00:00:00 2001 From: trisdoan Date: Tue, 30 Dec 2025 11:49:58 +0700 Subject: [PATCH 2/2] fix: introduce publish step Before this change, release step is not added when publish_to_pypi=false --- ...ml{% endif %}.jinja => release.yaml.jinja} | 36 ------------------ ...sh_to_pypi %}publish.yaml{% endif %}.jinja | 38 +++++++++++++++++++ 2 files changed, 38 insertions(+), 36 deletions(-) rename template/{% if enable_github_action %}.github{% endif%}/workflows/{{% if publish_to_pypi %}release.yaml{% endif %}.jinja => release.yaml.jinja} (57%) create mode 100644 template/{% if enable_github_action %}.github{% endif%}/workflows/{% if publish_to_pypi %}publish.yaml{% endif %}.jinja diff --git a/template/{% if enable_github_action %}.github{% endif%}/workflows/{% if publish_to_pypi %}release.yaml{% endif %}.jinja b/template/{% if enable_github_action %}.github{% endif%}/workflows/release.yaml.jinja similarity index 57% rename from template/{% if enable_github_action %}.github{% endif%}/workflows/{% if publish_to_pypi %}release.yaml{% endif %}.jinja rename to template/{% if enable_github_action %}.github{% endif%}/workflows/release.yaml.jinja index 936b406..4d298ac 100644 --- a/template/{% if enable_github_action %}.github{% endif%}/workflows/{% if publish_to_pypi %}release.yaml{% endif %}.jinja +++ b/template/{% if enable_github_action %}.github{% endif%}/workflows/release.yaml.jinja @@ -41,39 +41,3 @@ jobs: github_token: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} git_committer_name: "github-actions" git_committer_email: "actions@users.noreply.github.com" - - outputs: - released: {% raw %}${{ steps.release.outputs.released || 'false' }}{% endraw %} - tag: {% raw %}${{ steps.release.outputs.tag }}{% endraw %} - - - publish: - runs-on: ubuntu-latest - needs: release - if: {% raw %}${{ needs.release.outputs.released == 'true' }}{% endraw %} - - environment: - name: pypi - url: https://pypi.org/p/{{ project_name }} - - permissions: - contents: write - {# IMPORTANT: this permission is mandatory for Trusted Publishing #} - id-token: write - - steps: - - name: Check out at new tag - uses: actions/checkout@v4 - with: - ref: {% raw %}${{ needs.release.outputs.tag }}{% endraw %} - - - name: Set up the environment - uses: ./.github/actions/setup-python-env - - - name: Build Package - run: make build - - - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@v1.13.0 - with: - packages-dir: dist diff --git a/template/{% if enable_github_action %}.github{% endif%}/workflows/{% if publish_to_pypi %}publish.yaml{% endif %}.jinja b/template/{% if enable_github_action %}.github{% endif%}/workflows/{% if publish_to_pypi %}publish.yaml{% endif %}.jinja new file mode 100644 index 0000000..bf8b826 --- /dev/null +++ b/template/{% if enable_github_action %}.github{% endif%}/workflows/{% if publish_to_pypi %}publish.yaml{% endif %}.jinja @@ -0,0 +1,38 @@ +name: publish + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + publish: + runs-on: ubuntu-latest + + permissions: + contents: write + {# IMPORTANT: this permission is mandatory for Trusted Publishing #} + id-token: write + + environment: + name: pypi + url: https://pypi.org/p/{{ project_name }} + + steps: + - name: Check out at new tag + uses: actions/checkout@v4 + with: + ref: {% raw %}${{ github.event.release.tag_name }}{% endraw %} + + - name: Set up the environment + uses: ./.github/actions/setup-python-env + + - name: Build Package + run: make build + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@v1.13.0 + with: + packages-dir: dist