Skip to content

Commit 14f4e50

Browse files
committed
Added bump-my-version to release workflow
1 parent 3345d3b commit 14f4e50

2 files changed

Lines changed: 109 additions & 21 deletions

File tree

.bumpversion.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[tool.bumpversion]
2+
current_version = "1.1.1"
3+
commit = true
4+
tag = true
5+
6+
[[tool.bumpversion.files]]
7+
filename = "src/framework.hpp"
8+
search = "static const char * VERSION = \"{current_version}\""
9+
replace = "static const char * VERSION = \"{new_version}\""

.github/workflows/build_release.yml

Lines changed: 100 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,112 @@ on:
55
types: [published]
66

77
workflow_dispatch:
8+
inputs:
9+
version_type:
10+
type: choice
11+
description: 'Version Type'
12+
required: true
13+
default: rebuild
14+
options:
15+
- rebuild
16+
- patch
17+
- minor
18+
- major
19+
publish_release:
20+
description: "Publish Release"
21+
type: boolean
22+
required: true
23+
default: true
824

925
jobs:
10-
build:
11-
name: Build
12-
permissions: write-all
26+
bump_version:
27+
name: Bump Version
28+
runs-on: ubuntu-latest
29+
permissions: write-all
30+
outputs:
31+
current_version: ${{ steps.get_version.outputs.current_version }}
32+
new_version: ${{ steps.bump.outputs.current-version || steps.bump_manual.outputs.current-version }}
33+
steps:
34+
- uses: actions/checkout@v4
35+
- uses: fregante/setup-git-user@v2
36+
37+
- name: Install bump-my-version
38+
run: pip install bump-my-version
1339

14-
runs-on: windows-latest
40+
- name: Get current version
41+
id: get_version
42+
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version_type == 'rebuild' }}
43+
run: echo "current_version=$(bump-my-version show current_version)" >> $GITHUB_OUTPUT
1544

16-
steps:
17-
- uses: actions/checkout@v4
45+
- name: Bump version
46+
id: bump
47+
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version_type != 'rebuild' }}
48+
run: |
49+
echo "previous-version=$(bump-my-version show current_version)" >> $GITHUB_OUTPUT
50+
bump-my-version bump ${{ inputs.version_type }}
51+
([[ $? -gt 0 ]] && echo "bumped=false" || echo "bumped=true") >> $GITHUB_OUTPUT
52+
echo "current-version=$(bump-my-version show current_version)" >> $GITHUB_OUTPUT
1853
19-
- name: Add msbuild to PATH
20-
uses: microsoft/setup-msbuild@v2
54+
- name: Bump version (Manual)
55+
id: bump_manual
56+
if: ${{ github.event_name == 'release' }}
57+
run: |
58+
echo "previous-version=$(bump-my-version show current_version)" >> $GITHUB_OUTPUT
59+
bump-my-version bump --new-version ${{ github.ref_name }}
60+
([[ $? -gt 0 ]] && echo "bumped=false" || echo "bumped=true") >> $GITHUB_OUTPUT
61+
echo "current-version=$(bump-my-version show current_version)" >> $GITHUB_OUTPUT
2162
22-
- name: Integrate vcpkg
23-
run: vcpkg integrate install
63+
build:
64+
name: Build
65+
permissions: write-all
66+
needs: bump_version
67+
runs-on: windows-latest
2468

25-
- name: Build
26-
run: msbuild QuantumStreamer.sln -property:Configuration=Release
69+
steps:
70+
- uses: actions/checkout@v4
71+
if: ${{ github.event_name == 'release' || github.event.inputs.version_type == 'rebuild' }}
2772

28-
- name: Upload release artifact
29-
uses: actions/upload-artifact@v4
30-
with:
31-
name: ReleaseBuild
32-
path: x64\Release
73+
- uses: actions/checkout@v4
74+
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version_type != 'rebuild' }}
75+
with:
76+
ref: v${{ needs.bump_version.outputs.new_version }}
3377

34-
- name: Upload Release
35-
uses: softprops/action-gh-release@v2
36-
with:
37-
files: ./x64/Release/loc_x64_f.dll
78+
- name: Add msbuild to PATH
79+
uses: microsoft/setup-msbuild@v2
80+
81+
- name: Integrate vcpkg
82+
run: vcpkg integrate install
83+
84+
- name: Build
85+
run: msbuild QuantumStreamer.sln -property:Configuration=Release
86+
87+
- name: Upload release artifact
88+
uses: actions/upload-artifact@v4
89+
with:
90+
name: ReleaseBuild
91+
path: x64\Release
92+
93+
- name: Upload Release
94+
uses: softprops/action-gh-release@v2
95+
with:
96+
files: ./x64/Release/loc_x64_f.dll
97+
98+
- name: Upload Release (manual)
99+
if: ${{ github.event_name == 'release' }}
100+
uses: softprops/action-gh-release@v2
101+
with:
102+
files: ./x64/Release/loc_x64_f.dll
103+
104+
- name: Upload Release
105+
if: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_release == 'true' && github.event.inputs.version_type != 'rebuild') || github.event_name == 'release' }}
106+
uses: softprops/action-gh-release@v2
107+
with:
108+
files: ./x64/Release/loc_x64_f.dll
109+
tag_name: v${{ needs.bump_version.outputs.new_version }}
110+
111+
- name: Upload Re-Release
112+
if: ${{ (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_release == 'true' && github.event.inputs.version_type == 'rebuild') && github.event_name != 'release' }}
113+
uses: softprops/action-gh-release@v2
114+
with:
115+
files: ./x64/Release/loc_x64_f.dll
116+
tag_name: v${{ needs.bump_version.outputs.current_version }}

0 commit comments

Comments
 (0)