From f24cc30989f0a697d3200a08e54438d901da433a Mon Sep 17 00:00:00 2001 From: Charles Moulliard Date: Thu, 2 Jul 2026 15:33:26 +0200 Subject: [PATCH] Add a new flow and configure the maven plugin to release the early-access version = snapshot Signed-off-by: Charles Moulliard --- .github/workflows/early-access.yml | 120 +++++++++++++++++++++++++++++ .github/workflows/mvn-build.yml | 24 ++++++ jbang-catalog.json | 4 +- pom.xml | 90 ++++++++++++++++++++++ 4 files changed, 236 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/early-access.yml create mode 100644 .github/workflows/mvn-build.yml diff --git a/.github/workflows/early-access.yml b/.github/workflows/early-access.yml new file mode 100644 index 0000000..c6a1f55 --- /dev/null +++ b/.github/workflows/early-access.yml @@ -0,0 +1,120 @@ +name: CI - Early Access + +on: + schedule: + # Runs at 00:00 UTC every day + - cron: '0 0 * * *' + workflow_dispatch: + +permissions: + contents: write + +env: + JAVA_VERSION: '21' + JAVA_DISTRO: 'temurin' + +jobs: + precheck: + if: github.repository == 'snowdrop/acp-client' && startsWith(github.event.head_commit.message, 'Releasing version') != true + runs-on: ubuntu-latest + outputs: + VERSION: ${{ steps.vars.outputs.VERSION }} + steps: + - name: Checkout + uses: actions/checkout@v7 + + - name: Cancel previous run + uses: styfle/cancel-workflow-action@0.13.1 + with: + access_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup Java + uses: actions/setup-java@v5 + with: + java-version: ${{ env.JAVA_VERSION }} + distribution: ${{ env.JAVA_DISTRO }} + cache: maven + + - name: Version + id: vars + shell: bash + run: | + VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) + echo "VERSION=$(echo $VERSION)" >> $GITHUB_OUTPUT + + release: + needs: [ precheck ] + if: endsWith(${{ needs.precheck.outputs.VERSION }}, '-SNAPSHOT') + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v7 + with: + fetch-depth: 0 + + - name: Setup Java + uses: actions/setup-java@v5 + with: + java-version: ${{ env.JAVA_VERSION }} + distribution: ${{ env.JAVA_DISTRO }} + cache: maven + server-id: central + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + gpg-private-key: ${{ secrets.GPG_SECRET_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE + + - name: Configure git user and email + run: | + git config --global user.email "action@github.com" + git config --global user.name "Github Action" + + - name: Build the uber-jar of the acp-java-client + run: | + mvn -ntp -B clean install -DskipTests -Dquarkus.package.jar.type=uber-jar + + - name: Update jBang catalog for snapshot + if: github.ref == 'refs/heads/main' + run: | + VERSION=${{ needs.precheck.outputs.VERSION }} + ARTIFACT_ID=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout -pl client) + GROUP_ID=$(mvn help:evaluate -Dexpression=project.groupId -q -DforceStdout -pl client) + SNAPSHOT_GAV="${GROUP_ID}:${ARTIFACT_ID}:${VERSION}:runner" + jq --arg gav "$SNAPSHOT_GAV" '.aliases.acp."script-ref" = $gav' jbang-catalog.json > tmp.json && mv tmp.json jbang-catalog.json + + - name: Commit the changes + run: | + VERSION=${{ needs.precheck.outputs.VERSION }} + git add . + if git diff --cached --quiet; then + echo "No changes detected in jbang-catalog.json. Skipping commit." + else + echo "Changes detected. Committing version ${VERSION}..." + git commit -m "update jbang catalog script-ref: ${VERSION}" + git push origin main + fi + + - name: Create early-access release with uber-jar + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + VERSION=${{ needs.precheck.outputs.VERSION }} + UBER_JAR=$(find client/target -name "*-runner.jar" -type f | head -1) + + # Delete existing early-access release if present + gh release delete early-access --yes --cleanup-tag 2>/dev/null || true + + # Create new early-access release + gh release create early-access \ + --title "Early Access - ${VERSION}" \ + --notes "Early access build of version ${VERSION}" \ + --prerelease \ + "${UBER_JAR}" + + - name: Deploy the maven GAV on central + run: | + mvn -B deploy -Prelease -DskipTests + env: + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} \ No newline at end of file diff --git a/.github/workflows/mvn-build.yml b/.github/workflows/mvn-build.yml new file mode 100644 index 0000000..ba9ffaa --- /dev/null +++ b/.github/workflows/mvn-build.yml @@ -0,0 +1,24 @@ +name: "CI - JDK 21 Build" + +on: + push: + branches: [ main ] + paths-ignore: + - '.github/project.yml' + pull_request: + branches: [ main ] + + +jobs: + build-jdk21: + name: "JDK 21 Build" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + - name: Set up JDK 21 + uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: 21 + - name: Build and test + run: mvn clean install -ntp -B diff --git a/jbang-catalog.json b/jbang-catalog.json index 5f18f34..bad8343 100644 --- a/jbang-catalog.json +++ b/jbang-catalog.json @@ -1,8 +1,8 @@ { "aliases": { "acp": { - "script-ref": "client/target/acp-java-client-0.1.0-SNAPSHOT-runner.jar", - "description": "ACP Java Client for any ACP-compatible agent" + "description": "ACP Java Client for any ACP-compatible agent", + "script-ref": "io.quarkiverse.ai:acp-java-client:0.1.0-SNAPSHOT:runner" } } } \ No newline at end of file diff --git a/pom.xml b/pom.xml index 742b4ee..c56b3e6 100644 --- a/pom.xml +++ b/pom.xml @@ -57,6 +57,11 @@ 3.6.3 3.35.3 + + 3.3.1 + 3.11.2 + 3.2.7 + 0.7.0 @@ -105,4 +110,89 @@ + + + + + org.apache.maven.plugins + maven-javadoc-plugin + ${maven-javadoc-plugin.version} + + none + true + + -Xdoclint:none + + + + + + + + + release + + + + org.apache.maven.plugins + maven-source-plugin + ${maven-source-plugin.version} + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + ${maven-javadoc-plugin.version} + + none + true + + -Xdoclint:none + + + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + ${maven-gpg-plugin.version} + + + sign-artifacts + verify + + sign + + + + + + org.sonatype.central + central-publishing-maven-plugin + ${central-publishing-maven-plugin.version} + true + + central + true + published + + + + + +