From f7526f91c383cc9a1d3be5c420f271c6c6f18409 Mon Sep 17 00:00:00 2001 From: tada5hi Date: Tue, 30 Jun 2026 18:49:36 +0200 Subject: [PATCH 1/2] ci: integrate release-please action Adopt release-please for automated versioning and releases, modeled on the hub-seeder setup and adapted for Python/Poetry/PyPI. - Add release-please-config.json (release-type: python, v-prefixed tags, bump-minor-pre-major) and bootstrap .release-please-manifest.json to the current version 0.2.16 to align with existing v* tags. - Add release.yml that runs release-please on pushes to main and, once a release is created, builds the package, publishes to PyPI via trusted publishing, and deploys the Sphinx docs. - Remove publish.yml and sphinx.yml; their tag-triggered jobs are folded into release.yml since tags created with GITHUB_TOKEN do not trigger separate workflows. --- .github/workflows/publish.yml | 38 ---------------- .github/workflows/release.yml | 85 +++++++++++++++++++++++++++++++++++ .github/workflows/sphinx.yml | 32 ------------- .release-please-manifest.json | 3 ++ release-please-config.json | 9 ++++ 5 files changed, 97 insertions(+), 70 deletions(-) delete mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/sphinx.yml create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index a36dbf2..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Publish to PyPI - -on: - push: - tags: - - "v*" - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v6 - - name: Set up Poetry - uses: ./.github/actions/setup-poetry - - name: Install dependencies - run: poetry install - - name: Build package - run: poetry build --no-interaction - - name: Upload build artifact - uses: actions/upload-artifact@v7 - with: - path: dist/ - name: package-dist - - publish: - runs-on: ubuntu-latest - needs: build - environment: pypi - permissions: - id-token: write - steps: - - name: Download build artifact - uses: actions/download-artifact@v8 - with: - path: ${{ github.workspace }}/dist/ - name: package-dist - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..3c89323 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,85 @@ +name: Release + +on: + push: + branches: + - main + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + +permissions: + contents: write + pull-requests: write + +jobs: + release-please: + runs-on: ubuntu-latest + outputs: + releases_created: ${{ steps.release.outputs.releases_created }} + steps: + - name: Release Please + id: release + uses: googleapis/release-please-action@v5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + build: + runs-on: ubuntu-latest + needs: release-please + if: needs.release-please.outputs.releases_created == 'true' + steps: + - uses: actions/checkout@v6 + - name: Set up Poetry + uses: ./.github/actions/setup-poetry + - name: Install dependencies + run: poetry install + - name: Build package + run: poetry build --no-interaction + - name: Upload build artifact + uses: actions/upload-artifact@v7 + with: + path: dist/ + name: package-dist + + publish: + runs-on: ubuntu-latest + needs: build + environment: pypi + permissions: + id-token: write + steps: + - name: Download build artifact + uses: actions/download-artifact@v8 + with: + path: ${{ github.workspace }}/dist/ + name: package-dist + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + docs: + runs-on: ubuntu-latest + needs: release-please + if: needs.release-please.outputs.releases_created == 'true' + permissions: + contents: write + steps: + - uses: actions/checkout@v6 + with: + persist-credentials: false + - name: Set up Poetry + uses: ./.github/actions/setup-poetry + - name: Install dependencies + run: poetry install --with docs + - name: Build HTML + run: poetry run make -C docs/ html + - name: Upload artifacts + uses: actions/upload-artifact@v7 + with: + name: html-docs + path: docs/_build/html + - name: Deploy + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: docs/_build/html diff --git a/.github/workflows/sphinx.yml b/.github/workflows/sphinx.yml deleted file mode 100644 index d1e26ac..0000000 --- a/.github/workflows/sphinx.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Build and deploy Sphinx documentation - -on: - push: - tags: - - "v*" - -jobs: - build: - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - uses: actions/checkout@v6 - with: - persist-credentials: false - - name: Set up Poetry - uses: ./.github/actions/setup-poetry - - name: Install dependencies - run: poetry install --with docs - - name: Build HTML - run: poetry run make -C docs/ html - - name: Upload artifacts - uses: actions/upload-artifact@v7 - with: - name: html-docs - path: docs/_build/html - - name: Deploy - uses: peaceiris/actions-gh-pages@v4 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: docs/_build/html diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..fa97484 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.2.16" +} diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..4ea4fb1 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,9 @@ +{ + "release-type": "python", + "include-component-in-tag": false, + "include-v-in-tag": true, + "bump-minor-pre-major": true, + "packages": { + ".": {} + } +} From b775248df6f5d8b52ec126096c97e6dc037f6a60 Mon Sep 17 00:00:00 2001 From: tada5hi Date: Tue, 30 Jun 2026 18:51:55 +0200 Subject: [PATCH 2/2] ci: gate publish job explicitly on releases_created --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3c89323..2438b5d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -44,7 +44,8 @@ jobs: publish: runs-on: ubuntu-latest - needs: build + needs: [release-please, build] + if: needs.release-please.outputs.releases_created == 'true' environment: pypi permissions: id-token: write