Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 34 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
Loading