Skip to content

Commit a6f482e

Browse files
aksOpsclaude
andcommitted
feat: add beta auto-release workflow for Java rewrite
Add beta-java.yml workflow that auto-publishes to OSSRH on pushes to the java branch (src/** or pom.xml changes). Uses tag-based version incrementing (v0.0.1-beta.N) and creates GitHub pre-releases. Also update release-java.yml to use OSS_NEXUS_USER/OSS_NEXUS_PASS secret names for consistency. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3ffadac commit a6f482e

2 files changed

Lines changed: 76 additions & 2 deletions

File tree

.github/workflows/beta-java.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Beta Release (Java)
2+
on:
3+
push:
4+
branches: [java]
5+
paths: ['src/**', 'pom.xml']
6+
workflow_dispatch:
7+
8+
jobs:
9+
beta:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
packages: write
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- uses: actions/setup-java@v4
20+
with:
21+
distribution: 'temurin'
22+
java-version: '25'
23+
cache: 'maven'
24+
server-id: central
25+
server-username: MAVEN_USERNAME
26+
server-password: MAVEN_PASSWORD
27+
28+
- name: Determine beta version
29+
id: version
30+
run: |
31+
LATEST_BETA=$(git tag -l 'v0.0.1-beta.*' | sort -V | tail -1)
32+
if [ -z "$LATEST_BETA" ]; then
33+
NEXT_NUM=0
34+
else
35+
CURRENT_NUM=$(echo "$LATEST_BETA" | grep -oP 'beta\.\K[0-9]+')
36+
NEXT_NUM=$((CURRENT_NUM + 1))
37+
fi
38+
VERSION="0.0.1-beta.${NEXT_NUM}"
39+
echo "version=$VERSION" >> $GITHUB_OUTPUT
40+
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
41+
echo "Next beta version: $VERSION"
42+
43+
- name: Set version in pom.xml
44+
env:
45+
BETA_VERSION: ${{ steps.version.outputs.version }}
46+
run: mvn versions:set -DnewVersion="$BETA_VERSION" -B
47+
48+
- name: Build and test
49+
run: mvn clean verify -B
50+
51+
- name: Deploy to Maven Central (OSSRH)
52+
env:
53+
MAVEN_USERNAME: ${{ secrets.OSS_NEXUS_USER }}
54+
MAVEN_PASSWORD: ${{ secrets.OSS_NEXUS_PASS }}
55+
run: mvn deploy -DskipTests -Dgpg.skip=true -B
56+
57+
- name: Create git tag
58+
env:
59+
BETA_TAG: ${{ steps.version.outputs.tag }}
60+
BETA_VERSION: ${{ steps.version.outputs.version }}
61+
run: |
62+
git config user.name "github-actions[bot]"
63+
git config user.email "github-actions[bot]@users.noreply.github.com"
64+
git tag -a "$BETA_TAG" -m "Beta release $BETA_VERSION"
65+
git push origin "$BETA_TAG"
66+
67+
- name: Create GitHub Release
68+
uses: softprops/action-gh-release@v2
69+
with:
70+
tag_name: ${{ steps.version.outputs.tag }}
71+
name: "Beta ${{ steps.version.outputs.version }}"
72+
prerelease: true
73+
generate_release_notes: true
74+
files: target/code-iq-*.jar

.github/workflows/release-java.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ jobs:
2727
run: mvn versions:set -DnewVersion="$RELEASE_VERSION"
2828
- name: Deploy to Maven Central
2929
env:
30-
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
31-
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
30+
MAVEN_USERNAME: ${{ secrets.OSS_NEXUS_USER }}
31+
MAVEN_PASSWORD: ${{ secrets.OSS_NEXUS_PASS }}
3232
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
3333
run: mvn clean deploy -P release -B
3434
- name: Tag release

0 commit comments

Comments
 (0)