-
Notifications
You must be signed in to change notification settings - Fork 2
39 lines (33 loc) · 1.34 KB
/
update_version.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Update pyproject.toml Version
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
jobs:
update-version:
if: startsWith(github.event.comment.body, 'update-version=')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Extract version from comment
id: extract_version
run: |
echo "Requested comment: ${{ github.event.comment.body }}"
VERSION=$(echo "${{ github.event.comment.body }}" | sed 's/update-version=//')
echo "VERSION: $VERSION"
echo "::set-output name=version::$VERSION"
- name: Update version in pyproject.toml
run: |
sed -i 's/version = "[^"]*"/version = "${{ steps.extract_version.outputs.version }}"/' pyproject.toml
- name: Display pyproject.toml after modification
run: cat pyproject.toml
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: update-version-${{ steps.extract_version.outputs.version }}
base: develop
title: "release: update version to ${{ steps.extract_version.outputs.version }}"
body: "This PR updates the version in pyproject.toml to ${{ steps.extract_version.outputs.version }}."