generated from IvanMurzak/Unity-Package-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 127
52 lines (45 loc) · 1.69 KB
/
bump_version.yml
File metadata and controls
52 lines (45 loc) · 1.69 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
name: bump version
on:
workflow_dispatch:
inputs:
version:
description: "New version number (e.g. 1.2.3)"
required: true
type: string
jobs:
bump-version:
runs-on: ubuntu-latest
steps:
- name: Validate version format
run: |
if ! [[ "${{ github.event.inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: version must be in X.X.X format (got: ${{ github.event.inputs.version }})"
exit 1
fi
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create release branch
run: |
git config user.name "IvanMurzak"
git config user.email "Ivan.D.Murzak@gmail.com"
git fetch origin
git checkout -B release/${{ github.event.inputs.version }}
- name: Run bump-version script
shell: pwsh
run: ./commands/bump-version.ps1 -NewVersion "${{ github.event.inputs.version }}"
- name: Commit and push version bump
run: |
git add -A
git commit -m "chore: bump version to ${{ github.event.inputs.version }}"
git push --force-with-lease origin release/${{ github.event.inputs.version }}
- name: Create pull request
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create \
--base ${{ github.ref_name }} \
--head release/${{ github.event.inputs.version }} \
--title "chore: bump version to ${{ github.event.inputs.version }}" \
--body "Automated version bump to \`${{ github.event.inputs.version }}\` triggered via workflow dispatch."