Skip to content

Commit a32b579

Browse files
authored
Add manual release capability (#7522)
* Add manual release capability * Update docs for release action
1 parent b5b4b3d commit a32b579

3 files changed

Lines changed: 82 additions & 4 deletions

File tree

.github/workflows/gradle-release.yml

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ on:
44
push:
55
tags:
66
- "v*.*.*"
7+
workflow_dispatch:
8+
inputs:
9+
tag_name:
10+
description: 'Tag name for the release (e.g., v6.09.08 for production, v6.09.08-SNAPSHOT for nightly, v6.09.08.RC1 for release candidate). Must already exist.'
11+
required: true
12+
type: string
13+
prerelease:
14+
description: 'Mark as a pre-release (use for nightly builds and RCs)'
15+
required: false
16+
type: boolean
17+
default: false
718

819
permissions:
920
contents: write
@@ -13,13 +24,58 @@ jobs:
1324
name: Create Release
1425
runs-on: ubuntu-latest
1526
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
ref: ${{ inputs.tag_name || github.ref }}
30+
31+
- name: Validate tag matches gradle.properties version
32+
run: |
33+
TAG_NAME="${{ inputs.tag_name || github.ref_name }}"
34+
GRADLE_VERSION=$(grep '^version=' gradle.properties | head -1 | cut -d'=' -f2 | tr -d '[:space:]')
35+
EXPECTED_TAG="v${GRADLE_VERSION}"
36+
37+
echo "Tag name: ${TAG_NAME}"
38+
echo "gradle.properties version: ${GRADLE_VERSION}"
39+
echo "Expected tag: ${EXPECTED_TAG}"
40+
echo ""
41+
42+
if [ "${TAG_NAME}" != "${EXPECTED_TAG}" ]; then
43+
echo "::error::Tag '${TAG_NAME}' does not match gradle.properties version '${GRADLE_VERSION}'."
44+
echo ""
45+
echo "========================================="
46+
echo " HOW TO FIX"
47+
echo "========================================="
48+
echo ""
49+
echo "Option 1: Update gradle.properties to match the tag"
50+
echo " - Edit gradle.properties and set: version=${TAG_NAME#v}"
51+
echo " - Commit, push, then re-tag:"
52+
echo " git tag -d ${TAG_NAME}"
53+
echo " git push origin :refs/tags/${TAG_NAME}"
54+
echo " git tag ${TAG_NAME}"
55+
echo " git push origin ${TAG_NAME}"
56+
echo ""
57+
echo "Option 2: Create the correct tag for the current version"
58+
echo " - git tag ${EXPECTED_TAG}"
59+
echo " - git push origin ${EXPECTED_TAG}"
60+
echo " - Then trigger this workflow with tag: ${EXPECTED_TAG}"
61+
echo ""
62+
echo "Option 3: Manual dispatch with the correct tag"
63+
echo " - Go to Actions > 'Create Release' > Run workflow"
64+
echo " - Enter tag_name: ${EXPECTED_TAG}"
65+
echo "========================================="
66+
exit 1
67+
fi
68+
69+
echo "✅ Tag matches gradle.properties version."
70+
1671
- name: Create Release
1772
id: create_release
1873
uses: softprops/action-gh-release@v2
1974
with:
20-
name: ${{ github.ref_name }}
75+
tag_name: ${{ inputs.tag_name || github.ref_name }}
76+
name: ${{ inputs.tag_name || github.ref_name }}
2177
draft: false
22-
prerelease: false
78+
prerelease: ${{ inputs.prerelease || false }}
2379
generate_release_notes: false
2480

2581
build_release:
@@ -41,6 +97,23 @@ jobs:
4197
runs-on: ${{ matrix.os }}
4298
steps:
4399
- uses: actions/checkout@v4
100+
with:
101+
ref: ${{ inputs.tag_name || github.ref }}
102+
103+
- name: Update PCGenProp.properties with release version and date
104+
run: |
105+
PROPS_FILE="code/src/resources/pcgen/system/prop/PCGenProp.properties"
106+
GRADLE_VERSION=$(grep '^version=' gradle.properties | head -1 | cut -d'=' -f2 | tr -d '[:space:]')
107+
RELEASE_DATE=$(date -u +%Y-%m-%d)
108+
109+
echo "Setting VersionNumber=${GRADLE_VERSION} and ReleaseDate=${RELEASE_DATE} in ${PROPS_FILE}"
110+
111+
sed -i.bak "s/^VersionNumber=.*/VersionNumber=${GRADLE_VERSION}/" "${PROPS_FILE}"
112+
sed -i.bak "s/^ReleaseDate=.*/ReleaseDate=${RELEASE_DATE}/" "${PROPS_FILE}"
113+
rm -f "${PROPS_FILE}.bak"
114+
115+
echo "Updated ${PROPS_FILE}:"
116+
grep -E '^(VersionNumber|ReleaseDate)=' "${PROPS_FILE}"
44117
45118
- name: Set up JDK 25
46119
uses: actions/setup-java@v4

code/src/resources/pcgen/system/prop/PCGenProp.properties

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@
22
# Copyright (C) 2001 Thomas G. W. Epperly
33
# Released under the Lesser Gnu Public License
44
#
5+
# NOTE: VersionNumber and ReleaseDate are automatically updated by the
6+
# GitHub Actions release workflow (gradle-release.yml) at build time.
7+
# The version is read from gradle.properties and the date is set to the
8+
# current build date. Manual edits to these two fields will be overwritten.
9+
#
510
HeadCodeMonkey=Bryan McRoberts (Benevolent Dictator)
611

712
# Version number should be x.y.z (e.g. 2.0.0) - RC is x.xx.xx RCx
8-
VersionNumber=6.09.08
13+
VersionNumber=6.09.08.RC1
914
ReleaseDate=2020-07-27
1015
CodeMonkeys=B. K. Oxley (binkley), Jonas Karlsson, Matthew Woodard, Peter Kahle, Tim Dugger, Tom Epperly, Brian Forester, Mario Bonassin, Jason Buchanan, Mark Hulsmanand, Jerry Hill, Eric Statz, Kurt Wimmer, David Fallon, Tyler Bannister, Thomas Clegg, Greg Bingleman, Emily Smirle, Arcady, Thomas Behr, Ryan Koppenhaver, Jayme Cox, Scott Ellsworth, Chris Ryan, James Dempsey, Walter Duncan, Devon Jones, Felipe Diniz, Frugal, Richard Askham, David Hibbs, John Watson, Stefan Radermacher, Ross Lodge, Benjamin Pew, Brian Kuehn, Aaron Divinsky, Andrew Wilson, Brian Hoff, Tom Parker, Andriy Sen, Koen Van Daele, Tobias Wichtrey, Per Christian Henden, Connor Petty, Dan Parks, Jasper Spaans, Steven West (redwolf3), Michael Isaacson, Vincent Lhote, Javier A. Ortiz Bultron, Gabriel Sorrel, John Carimando (UI), Andrew Maitland (LegacyKing), Eitan Adler, Jacob Raihle
1116
TestMonkeys=Dave Cortijo, Martin Brabander, John Sussenberger, Stephen Gryphon, Richard O'Doherty-Gregg, Brad Stiles, Chris Andersen, Joseff, and many more. Andrew Maitland, David R. Bender, Patryk Adamski, Paul Grosse, ratbird32, Stefan Radermacher, Vincent Lhote and Henk Slaaf (UI Beta testers)

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#version=6.09.06-SNAPSHOT
2-
version=6.09.08
2+
version=6.09.08.RC1
33
localOnly = false
44
org.gradle.jvmargs=-Xmx4096m
55

0 commit comments

Comments
 (0)