Repository navigation
61 lines (53 loc) · 1.79 KB
/
Copy pathrelease.yml
File metadata and controls
61 lines (53 loc) · 1.79 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
53
54
55
56
57
58
59
60
61
name: Create Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version (e.g., 1.2.3)'
required: true
type: string
version_type:
description: 'Version type'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
jobs:
release:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Validate inputs
run: |
# Validate version format (X.Y.Z)
if [[ ! "${{ github.event.inputs.version }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid version format. Expected: X.Y.Z (e.g., 1.2.3)"
exit 1
fi
# Validate version_type
case "${{ github.event.inputs.version_type }}" in
patch|minor|major) echo "Valid version_type" ;;
*) echo "Invalid version_type. Expected: patch, minor, or major"; exit 1 ;;
esac
- name: Bump version
run: python scripts/version_bump.py ${{ github.event.inputs.version_type }}
- name: Commit version bump
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add .
git commit -m "Bump version to ${{ github.event.inputs.version }}"
git tag v${{ github.event.inputs.version }}
git push origin main && git push origin v${{ github.event.inputs.version }}
- name: Trigger build workflow
uses: benc-uk/workflow-dispatch@v1
with:
workflow: build.yml
ref: refs/tags/v${{ github.event.inputs.version }}