Skip to content

Commit 4c2c05f

Browse files
authored
Merge pull request #7 from IvanMurzak/IvanMurzak-patch-1
Add workflow to bump version and create pull request
2 parents 06195e4 + 3ffe1b6 commit 4c2c05f

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

.github/workflows/bump_version.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: bump version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "New version number (e.g. 1.2.3)"
8+
required: true
9+
type: string
10+
11+
jobs:
12+
bump-version:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Validate version format
16+
run: |
17+
if ! [[ "${{ github.event.inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
18+
echo "Error: version must be in X.X.X format (got: ${{ github.event.inputs.version }})"
19+
exit 1
20+
fi
21+
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
with:
25+
token: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Create release branch
28+
run: |
29+
git config user.name "IvanMurzak"
30+
git config user.email "Ivan.D.Murzak@gmail.com"
31+
git checkout -b release/${{ github.event.inputs.version }}
32+
33+
- name: Run bump-version script
34+
shell: pwsh
35+
run: ./commands/bump-version.ps1 -NewVersion "${{ github.event.inputs.version }}"
36+
37+
- name: Commit and push version bump
38+
run: |
39+
git add -A
40+
git commit -m "chore: bump version to ${{ github.event.inputs.version }}"
41+
git push origin release/${{ github.event.inputs.version }}
42+
43+
- name: Create pull request
44+
env:
45+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
run: |
47+
gh pr create \
48+
--base ${{ github.ref_name }} \
49+
--head release/${{ github.event.inputs.version }} \
50+
--title "chore: bump version to ${{ github.event.inputs.version }}" \
51+
--body "Automated version bump to \`${{ github.event.inputs.version }}\` triggered via workflow dispatch."

0 commit comments

Comments
 (0)