Skip to content

Commit ea6e213

Browse files
aksOpsclaude
andcommitted
Switch to manual beta releases with auto-versioning and add CLI classifier
- Rewrite beta-java.yml: manual trigger only, auto-increments beta version from latest tag (0.0.1-beta.N format), deploys with -P release profile, creates GitHub Release with CLI JAR - Remove SNAPSHOT distributionManagement from pom.xml (no longer needed) - Add cli classifier to spring-boot-maven-plugin for discoverable fat JAR - Update release-java.yml to upload only the CLI JAR to GitHub Releases Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 428cb64 commit ea6e213

3 files changed

Lines changed: 49 additions & 18 deletions

File tree

.github/workflows/beta-java.yml

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
name: Snapshot Deploy (Java)
1+
name: Beta Release (Java)
22
on:
3-
push:
4-
branches: [java]
5-
paths: ['src/**', 'pom.xml']
6-
workflow_dispatch:
3+
workflow_dispatch: # Manual trigger ONLY
74

85
jobs:
9-
snapshot:
6+
beta:
107
runs-on: ubuntu-latest
118
permissions:
12-
contents: read
9+
contents: write
1310
packages: write
1411
steps:
1512
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
1615

1716
- uses: actions/setup-java@v4
1817
with:
@@ -22,12 +21,48 @@ jobs:
2221
server-id: central
2322
server-username: MAVEN_USERNAME
2423
server-password: MAVEN_PASSWORD
24+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
25+
26+
- name: Determine beta version
27+
id: version
28+
run: |
29+
LATEST_BETA=$(git tag -l 'v0.0.1-beta.*' | sort -V | tail -1)
30+
if [ -z "$LATEST_BETA" ]; then
31+
NEXT_NUM=0
32+
else
33+
CURRENT_NUM=$(echo "$LATEST_BETA" | grep -oP 'beta\.\K[0-9]+')
34+
NEXT_NUM=$((CURRENT_NUM + 1))
35+
fi
36+
VERSION="0.0.1-beta.${NEXT_NUM}"
37+
echo "version=$VERSION" >> $GITHUB_OUTPUT
38+
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
39+
echo "Next beta version: $VERSION"
40+
41+
- name: Set version in pom.xml
42+
run: mvn versions:set -DnewVersion=${{ steps.version.outputs.version }} -B
2543

2644
- name: Build and test
2745
run: mvn clean verify -B
2846

29-
- name: Deploy SNAPSHOT to OSSRH
47+
- name: Deploy to Maven Central
3048
env:
3149
MAVEN_USERNAME: ${{ secrets.OSS_NEXUS_USER }}
3250
MAVEN_PASSWORD: ${{ secrets.OSS_NEXUS_PASS }}
33-
run: mvn deploy -DskipTests -Dgpg.skip=true -B
51+
run: mvn deploy -P release -DskipTests -B
52+
53+
- name: Create git tag
54+
run: |
55+
git config user.name "github-actions[bot]"
56+
git config user.email "github-actions[bot]@users.noreply.github.com"
57+
git tag -a ${{ steps.version.outputs.tag }} -m "Beta release ${{ steps.version.outputs.version }}"
58+
git push origin ${{ steps.version.outputs.tag }}
59+
60+
- name: Create GitHub Release
61+
uses: softprops/action-gh-release@v2
62+
with:
63+
tag_name: ${{ steps.version.outputs.tag }}
64+
name: "Beta ${{ steps.version.outputs.version }}"
65+
prerelease: true
66+
generate_release_notes: true
67+
files: |
68+
target/code-iq-*-cli.jar

.github/workflows/release-java.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,5 @@ jobs:
4141
with:
4242
tag_name: v${{ inputs.version }}
4343
generate_release_notes: true
44-
files: target/code-iq-*.jar
44+
files: |
45+
target/code-iq-*-cli.jar

pom.xml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,6 @@
3232
<checkstyle-plugin.version>3.6.0</checkstyle-plugin.version>
3333
</properties>
3434

35-
<!-- SNAPSHOTs go to OSSRH, releases go via Central Publishing Plugin -->
36-
<distributionManagement>
37-
<snapshotRepository>
38-
<id>central</id>
39-
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
40-
</snapshotRepository>
41-
</distributionManagement>
42-
4335
<dependencyManagement>
4436
<dependencies>
4537
<dependency>
@@ -167,6 +159,9 @@
167159
<plugin>
168160
<groupId>org.springframework.boot</groupId>
169161
<artifactId>spring-boot-maven-plugin</artifactId>
162+
<configuration>
163+
<classifier>cli</classifier>
164+
</configuration>
170165
</plugin>
171166

172167
<plugin>

0 commit comments

Comments
 (0)