Skip to content

Commit 2880afe

Browse files
committed
manual dispatch of release
1 parent 552e004 commit 2880afe

2 files changed

Lines changed: 24 additions & 22 deletions

File tree

.github/workflows/build-and-release.yml

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
name: Build and Release
22

3-
on:
4-
push:
5-
branches:
6-
- master
7-
tags:
8-
- 'v*'
3+
on:
94
workflow_dispatch:
105
inputs:
116
version:
127
description: 'Version to release (e.g., 8.0.1)'
13-
required: true
8+
required: false
149
type: string
1510
auto_release:
1611
description: 'Automatically create GitHub release'
17-
required: true
12+
required: false
1813
type: boolean
1914
default: false
2015

@@ -55,21 +50,28 @@ jobs:
5550
- name: Determine version
5651
id: version
5752
run: |
58-
# Use version from latest git tag, fallback to build.gradle.kts if no tags exist
59-
git fetch --tags
60-
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
61-
62-
if [ -n "$LATEST_TAG" ]; then
63-
# Remove 'v' or 'V' prefix if present
64-
VERSION=${LATEST_TAG#v}
65-
VERSION=${VERSION#V}
66-
echo "Using version from git tag: $VERSION"
53+
INPUT_VERSION="${{ github.event.inputs.version }}"
54+
55+
if [ -n "$INPUT_VERSION" ]; then
56+
VERSION="$INPUT_VERSION"
57+
echo "Using version from manual input: $VERSION"
6758
else
68-
# Fallback to build.gradle.kts
69-
VERSION=$(grep '^version = ' build.gradle.kts | head -1 | sed 's/.*"\(.*\)".*/\1/')
70-
echo "No git tags found, using version from build.gradle.kts: $VERSION"
59+
# Use version from latest git tag, fallback to build.gradle.kts if no tags exist
60+
git fetch --tags
61+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
62+
63+
if [ -n "$LATEST_TAG" ]; then
64+
# Remove 'v' or 'V' prefix if present
65+
VERSION=${LATEST_TAG#v}
66+
VERSION=${VERSION#V}
67+
echo "Using version from git tag: $VERSION"
68+
else
69+
# Fallback to build.gradle.kts
70+
VERSION=$(grep '^version = ' build.gradle.kts | head -1 | sed 's/.*"\(.*\)".*/\1/')
71+
echo "No git tags found, using version from build.gradle.kts: $VERSION"
72+
fi
7173
fi
72-
74+
7375
echo "version=$VERSION" >> $GITHUB_OUTPUT
7476
echo "Building version: $VERSION"
7577

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ val arm64Dist: String by project.extra { "" }
185185
val makeappExt = if (System.getProperty("os.name").lowercase().contains("mac")) "mac" else "linux"
186186

187187
fun getVersionFromGit(): String {
188-
val process = ProcessBuilder("git", "describe", "--tags", "--abbrev=0")
188+
val process = ProcessBuilder("git", "describe", "--tags", "--abbrev=0", "--match", "v[0-9]*")
189189
.directory(rootProject.projectDir)
190190
.redirectOutput(ProcessBuilder.Redirect.PIPE)
191191
.redirectError(ProcessBuilder.Redirect.PIPE)

0 commit comments

Comments
 (0)