From 53e04f5848dea8beb2abc6db179a095ca69b34d3 Mon Sep 17 00:00:00 2001 From: Uno-Takashi Date: Mon, 22 Jun 2026 10:27:21 +0000 Subject: [PATCH] ci: bump pyproject version and tag from version input Co-Authored-By: Claude Opus 4.8 --- .github/workflows/release.yml | 44 +++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 47aac9d..7f44862 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,29 +1,53 @@ name: Release +# d-party モノレポ root の release ワークフローから統一バージョンを受け取って起動される。 +# pyproject.toml の version を書き換えて main へコミットし、タグ + GitHub Release を作る。 + on: workflow_dispatch: inputs: version: - description: "Next Version" + description: "Release version (X.Y.Z)" required: true default: "x.y.z" release_note: description: "release note" required: false + jobs: release: runs-on: ubuntu-latest + permissions: + contents: write steps: - uses: actions/checkout@v4 - - name: Create Release - id: create_release - uses: actions/create-release@v1 + with: + ref: main + + - name: Bump version and commit env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERSION: ${{ github.event.inputs.version }} + run: | + set -euo pipefail + python3 - <<'EOF' + import os, re + v = os.environ["VERSION"] + path = "pyproject.toml" + s = open(path, encoding="utf-8").read() + s = re.sub(r'(?m)^version\s*=\s*".*"$', f'version = "{v}"', s, count=1) + open(path, "w", encoding="utf-8").write(s) + EOF + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add pyproject.toml + git commit -m "chore: bump version to v${VERSION} [skip ci]" + git push origin HEAD:main + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 with: tag_name: v${{ github.event.inputs.version }} - release_name: Release v${{ github.event.inputs.version }} - body: | - ${{ github.event.inputs.release_note }} - draft: false - prerelease: false + name: Release v${{ github.event.inputs.version }} + body: ${{ github.event.inputs.release_note }} + generate_release_notes: true + target_commitish: main