Skip to content

Commit 53e04f5

Browse files
Uno-Takashiclaude
andcommitted
ci: bump pyproject version and tag from version input
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 131754b commit 53e04f5

1 file changed

Lines changed: 34 additions & 10 deletions

File tree

.github/workflows/release.yml

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,53 @@
11
name: Release
22

3+
# d-party モノレポ root の release ワークフローから統一バージョンを受け取って起動される。
4+
# pyproject.toml の version を書き換えて main へコミットし、タグ + GitHub Release を作る。
5+
36
on:
47
workflow_dispatch:
58
inputs:
69
version:
7-
description: "Next Version"
10+
description: "Release version (X.Y.Z)"
811
required: true
912
default: "x.y.z"
1013
release_note:
1114
description: "release note"
1215
required: false
16+
1317
jobs:
1418
release:
1519
runs-on: ubuntu-latest
20+
permissions:
21+
contents: write
1622
steps:
1723
- uses: actions/checkout@v4
18-
- name: Create Release
19-
id: create_release
20-
uses: actions/create-release@v1
24+
with:
25+
ref: main
26+
27+
- name: Bump version and commit
2128
env:
22-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
VERSION: ${{ github.event.inputs.version }}
30+
run: |
31+
set -euo pipefail
32+
python3 - <<'EOF'
33+
import os, re
34+
v = os.environ["VERSION"]
35+
path = "pyproject.toml"
36+
s = open(path, encoding="utf-8").read()
37+
s = re.sub(r'(?m)^version\s*=\s*".*"$', f'version = "{v}"', s, count=1)
38+
open(path, "w", encoding="utf-8").write(s)
39+
EOF
40+
git config user.name "github-actions[bot]"
41+
git config user.email "github-actions[bot]@users.noreply.github.com"
42+
git add pyproject.toml
43+
git commit -m "chore: bump version to v${VERSION} [skip ci]"
44+
git push origin HEAD:main
45+
46+
- name: Create GitHub Release
47+
uses: softprops/action-gh-release@v2
2348
with:
2449
tag_name: v${{ github.event.inputs.version }}
25-
release_name: Release v${{ github.event.inputs.version }}
26-
body: |
27-
${{ github.event.inputs.release_note }}
28-
draft: false
29-
prerelease: false
50+
name: Release v${{ github.event.inputs.version }}
51+
body: ${{ github.event.inputs.release_note }}
52+
generate_release_notes: true
53+
target_commitish: main

0 commit comments

Comments
 (0)