Skip to content

Commit 8734695

Browse files
committed
build: update release workflow to create PR with release changes
1 parent cf3f8ac commit 8734695

File tree

2 files changed

+65
-22
lines changed

2 files changed

+65
-22
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name: Create a new GitHub Release
1+
name: Create a Release Pull Request
22

33
on:
44
workflow_dispatch:
55
inputs:
6-
tag:
6+
bump-type:
77
description: "The type of version bump"
88
required: true
99
type: choice
@@ -13,10 +13,10 @@ on:
1313
- "patch"
1414

1515
jobs:
16-
release:
16+
create-release-pr:
1717
runs-on: ubuntu-latest
1818
env:
19-
TAG: ${{ github.event.inputs.tag }}
19+
BUMP_TYPE: ${{ github.event.inputs.bump-type }}
2020

2121
steps:
2222
- name: Checkout
@@ -27,37 +27,35 @@ jobs:
2727
with:
2828
python-version: 3.11
2929

30-
- name: Install requirements
30+
- name: Install release requirements
3131
run: pip install scriv bump-my-version
3232

33-
- name: Install pandoc for scriv
34-
run: sudo apt install -y pandoc
35-
36-
- name: Set up Git
33+
- name: Configure Git user
3734
run: |
3835
git config user.name 'github-actions[bot]'
3936
git config user.email 'github-actions[bot]@users.noreply.github.com'
4037
41-
- name: Get current and new version
38+
- name: Compute version bump
4239
id: version
4340
run: |
4441
echo "CURRENT_VERSION=$(bump-my-version show current_version)" >> $GITHUB_OUTPUT
45-
echo "NEW_VERSION=$(bump-my-version show --increment $TAG new_version)" >> $GITHUB_OUTPUT
42+
echo "NEW_VERSION=$(bump-my-version show --increment $BUMP_TYPE new_version)" >> $GITHUB_OUTPUT
4643
4744
- name: Bump version
48-
run: bump-my-version bump $TAG
45+
run: bump-my-version bump $BUMP_TYPE
4946

5047
- name: Collect changelog
5148
run: make changelog
5249

53-
- name: Commit changes and create tag
54-
uses: stefanzweifel/git-auto-commit-action@v5
50+
- name: Create Pull Request
51+
uses: peter-evans/create-pull-request@v7
5552
with:
56-
branch: ${{ github.ref }}
57-
commit_message: "chore: bump version ${{ steps.version.outputs.CURRENT_VERSION }} → ${{ steps.version.outputs.NEW_VERSION }}"
58-
tagging_message: "v${{ steps.version.outputs.NEW_VERSION }}"
59-
60-
- name: Create GitHub release
61-
run: scriv github-release --repo=openedx/openedx-events
62-
env:
63-
GITHUB_TOKEN: ${{ github.token }}
53+
commit-message: "chore: bump version ${{ steps.version.outputs.CURRENT_VERSION }} → ${{ steps.version.outputs.NEW_VERSION }}"
54+
title: "v${{ steps.version.outputs.NEW_VERSION }} Release"
55+
body: |
56+
### Description
57+
58+
This PR bumps the version from `${{ steps.version.outputs.CURRENT_VERSION }}` to `${{ steps.version.outputs.NEW_VERSION }}`.
59+
60+
The changelog has been automatically generated using `scriv`.
61+
branch: "release-${{ steps.version.outputs.NEW_VERSION }}"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Create a new GitHub Release
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
github-release:
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
14+
- name: Set up Python
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: 3.11
18+
19+
- name: Install release requirements
20+
run: pip install scriv bump-my-version
21+
22+
- name: Install pandoc for scriv
23+
run: sudo apt install -y pandoc
24+
25+
- name: Configure Git user
26+
run: |
27+
git config user.name 'github-actions[bot]'
28+
git config user.email 'github-actions[bot]@users.noreply.github.com'
29+
30+
- name: Read current version
31+
id: version
32+
run: |
33+
echo "CURRENT_VERSION=$(bump-my-version show current_version)" >> $GITHUB_OUTPUT
34+
35+
- name: Create and push Git tag
36+
env:
37+
CURRENT_VERSION: ${{ steps.version.outputs.CURRENT_VERSION }}
38+
run: |
39+
git tag -a "v$CURRENT_VERSION" -m "Release v$CURRENT_VERSION"
40+
git push origin "v$CURRENT_VERSION"
41+
42+
- name: Create GitHub release
43+
run: scriv github-release --repo=openedx/openedx-events
44+
env:
45+
GITHUB_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)