Skip to content

Commit 39b085a

Browse files
committed
tmp: test release workflow
1 parent ef1034f commit 39b085a

File tree

2 files changed

+92
-15
lines changed

2 files changed

+92
-15
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Bump version and changelog v2
2+
on:
3+
push:
4+
5+
6+
jobs:
7+
bumpversion:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
11+
outputs:
12+
version: 1.0.1
13+
previous_tag: ${{ steps.tag_version.outputs.previous_tag }}
14+
bump_commit_sha: ${{ steps.bumpversion.outputs.commit_hash }}
15+
pr_number: ${{ steps.cpr.outputs.pull-request-number }}
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Get next version
19+
id: tag_version
20+
uses: mathieudutour/[email protected]
21+
with:
22+
github_token: ${{ secrets.GITHUB_TOKEN }}
23+
default_bump: 1.0.1
24+
default_prerelease_bump: false
25+
dry_run: true
26+
- name: Set up Python 3.12
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: "3.12"
30+
- name: Create bumpversion
31+
if: github.event.inputs.version
32+
run: |
33+
pip install bump2version
34+
bump2version --new-version 1.0.1 setup.cfg tutoraspects/__about__.py .ci/config.yml
35+
- name: Update Changelog
36+
if: github.event.inputs.version
37+
uses: stefanzweifel/[email protected]
38+
with:
39+
latest-version: 1.0.1
40+
release-notes: ${{ steps.tag_version.outputs.changelog }}
41+
- name: Push branch
42+
if: github.event.inputs.version
43+
run: |
44+
branch_name="bot/v1.0.1
45+
git fetch --prune origin
46+
if git show-ref --quiet refs/remotes/origin/$branch_name; then
47+
git push --delete origin $branch_name
48+
fi
49+
git checkout -b $branch_name || git checkout $branch_name
50+
git push origin $branch_name
51+
- name: Create Pull Request
52+
id: cpr
53+
uses: peter-evans/create-pull-request@v6
54+
with:
55+
token: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
56+
title: "chore: preparing release 1.0.1"
57+
commit-message: "chore: preparing release 1.0.1"
58+
branch: "bot/v${{github.event.inputs.version}}"
59+
base: main
60+
body: |
61+
Automated version bump for release 1.0.1.
62+
63+
This pull request was automatically generated. It includes the following changes:
64+
65+
- Version: 1.0.1
66+
- Previous version: ${{ steps.tag_version.outputs.previous_tag }}
67+
68+
${{ steps.tag_version.outputs.changelog }}
69+
70+
No code changes are included in this pull request. The purpose of this PR is to trigger a version bump for the project.
71+
72+
Once the pull request is merged, a new GitHub release will be created with the updated version.

.github/workflows/bump-version.yaml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ on:
33
workflow_dispatch:
44
inputs:
55
version:
6-
description: 'The version to release (e.g 1.2.3)'
6+
description: 'The version to bump to'
77
required: true
8-
default: ''
9-
type: string
8+
default: 'minor'
9+
type: choice
10+
options:
11+
- major
12+
- minor
13+
- patch
1014

1115

1216
jobs:
@@ -15,7 +19,7 @@ jobs:
1519
permissions:
1620
contents: write
1721
outputs:
18-
version: ${{ github.event.inputs.version }}
22+
version: ${{ steps.tag_version.outputs.new_version }}
1923
previous_tag: ${{ steps.tag_version.outputs.previous_tag }}
2024
bump_commit_sha: ${{ steps.bumpversion.outputs.commit_hash }}
2125
pr_number: ${{ steps.cpr.outputs.pull-request-number }}
@@ -34,41 +38,42 @@ jobs:
3438
with:
3539
python-version: "3.12"
3640
- name: Create bumpversion
37-
if: github.event.inputs.version
41+
if: steps.tag_version.outputs.new_version
3842
run: |
3943
pip install bump2version
40-
bump2version --new-version ${{ github.event.inputs.version }} setup.cfg tutoraspects/__about__.py .ci/config.yml
44+
bump2version --new-version ${{ steps.tag_version.outputs.new_version }} setup.cfg tutoraspects/__about__.py .ci/config.yml
4145
- name: Update Changelog
42-
if: github.event.inputs.version
46+
if: steps.tag_version.outputs.new_version
4347
uses: stefanzweifel/[email protected]
4448
with:
45-
latest-version: ${{ github.event.inputs.version }}
49+
latest-version: ${{ steps.tag_version.outputs.new_tag }}
4650
release-notes: ${{ steps.tag_version.outputs.changelog }}
4751
- name: Push branch
48-
if: github.event.inputs.version
52+
if: steps.tag_version.outputs.new_version
4953
run: |
50-
branch_name="bot/v${{ github.event.inputs.version }}"
54+
branch_name="bot/v${{ steps.tag_version.outputs.new_version }}"
5155
git fetch --prune origin
5256
if git show-ref --quiet refs/remotes/origin/$branch_name; then
5357
git push --delete origin $branch_name
5458
fi
5559
git checkout -b $branch_name || git checkout $branch_name
5660
git push origin $branch_name
5761
- name: Create Pull Request
62+
if: steps.tag_version.outputs.new_version
5863
id: cpr
5964
uses: peter-evans/create-pull-request@v6
6065
with:
6166
token: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
62-
title: "chore: preparing release ${{ github.event.inputs.version }}"
63-
commit-message: "chore: preparing release ${{ github.event.inputs.version }}"
64-
branch: "bot/v${{github.event.inputs.version}}"
67+
title: "chore: preparing release ${{ steps.tag_version.outputs.new_version }}"
68+
commit-message: "chore: preparing release ${{ steps.tag_version.outputs.new_version }}"
69+
branch: "bot/v${{steps.tag_version.outputs.new_version}}"
6570
base: main
6671
body: |
67-
Automated version bump for release ${{ github.event.inputs.version }}.
72+
Automated version bump for release ${{ steps.tag_version.outputs.new_version }}.
6873
6974
This pull request was automatically generated. It includes the following changes:
7075
71-
- Version: ${{ github.event.inputs.version }}
76+
- Version: ${{ steps.tag_version.outputs.new_version }}
7277
- Previous version: ${{ steps.tag_version.outputs.previous_tag }}
7378
7479
${{ steps.tag_version.outputs.changelog }}

0 commit comments

Comments
 (0)