Repository navigation
Release #51
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v[0-9]+.[0-9]+.[0-9]+' | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| name: Build, Publish and Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| token: ${{ secrets.ORG_RELEASE_TOKEN }} | |
| - name: Set up Java 21 | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: temurin | |
| java-version: 21 | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v6 | |
| - name: Extract version from tag | |
| id: version | |
| run: | | |
| TAG="${GITHUB_REF_NAME}" | |
| VERSION="${TAG#v}" | |
| echo "tag=${TAG}" >> "$GITHUB_OUTPUT" | |
| echo "version=${VERSION}" >> "$GITHUB_OUTPUT" | |
| echo "Releasing version: ${VERSION} (tag: ${TAG})" | |
| - name: Build and test | |
| run: ./gradlew build :agentensemble-core:plainJavadocJar :agentensemble-devtools:plainJavadocJar -Pversion=${{ steps.version.outputs.version }} | |
| - name: Publish all modules to Maven Central | |
| # Runs publishAndReleaseToMavenCentral on every subproject that has the | |
| # com.vanniktech.maven.publish plugin applied: agentensemble-core, | |
| # agentensemble-devtools, all 9 tool modules, agentensemble-tools-bom, | |
| # and agentensemble-metrics-micrometer. | |
| # Projects without the plugin (agentensemble-examples, parent containers) | |
| # do not have the task and are silently skipped. | |
| run: ./gradlew publishAndReleaseToMavenCentral -Pversion=${{ steps.version.outputs.version }} | |
| env: | |
| ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GPG_SIGNING_KEY }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GPG_SIGNING_PASSWORD }} | |
| ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_MAVEN_CENTRAL_USERNAME }} | |
| ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_MAVEN_CENTRAL_PASSWORD }} | |
| - name: Ensure GitHub Release exists | |
| run: | | |
| if ! gh release view ${{ steps.version.outputs.tag }} --json id > /dev/null 2>&1; then | |
| gh release create ${{ steps.version.outputs.tag }} \ | |
| --title "v${{ steps.version.outputs.version }}" \ | |
| --generate-notes | |
| fi | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload artifacts to GitHub Release | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| CORE_LIBS=agentensemble-core/build/libs | |
| DEVTOOLS_LIBS=agentensemble-devtools/build/libs | |
| gh release upload ${{ steps.version.outputs.tag }} \ | |
| "${CORE_LIBS}/agentensemble-core-${VERSION}.jar" \ | |
| "${CORE_LIBS}/agentensemble-core-${VERSION}-sources.jar" \ | |
| "${CORE_LIBS}/agentensemble-core-${VERSION}-javadoc.jar" \ | |
| "${DEVTOOLS_LIBS}/agentensemble-devtools-${VERSION}.jar" \ | |
| "${DEVTOOLS_LIBS}/agentensemble-devtools-${VERSION}-sources.jar" \ | |
| "${DEVTOOLS_LIBS}/agentensemble-devtools-${VERSION}-javadoc.jar" | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| - name: Set up Bun | |
| uses: oven-sh/setup-bun@v2 | |
| - name: Build agentensemble-viz | |
| working-directory: agentensemble-viz | |
| run: | | |
| npm ci | |
| npm run build | |
| - name: Compile agentensemble-viz binaries | |
| # Bun cross-compilation downloads the target runtime from the Bun CDN. | |
| # Each compile call overwrites the agentensemble-viz output file, so the | |
| # tarball is created before the next compile run. | |
| working-directory: agentensemble-viz | |
| run: | | |
| npm run compile:darwin-arm64 | |
| tar czf agentensemble-viz-darwin-arm64.tar.gz agentensemble-viz | |
| rm agentensemble-viz | |
| npm run compile:darwin-x64 | |
| tar czf agentensemble-viz-darwin-x64.tar.gz agentensemble-viz | |
| rm agentensemble-viz | |
| npm run compile:linux-x64 | |
| tar czf agentensemble-viz-linux-x64.tar.gz agentensemble-viz | |
| rm agentensemble-viz | |
| - name: Upload viz binaries to GitHub Release | |
| working-directory: agentensemble-viz | |
| run: | | |
| gh release upload ${{ steps.version.outputs.tag }} \ | |
| agentensemble-viz-darwin-arm64.tar.gz \ | |
| agentensemble-viz-darwin-x64.tar.gz \ | |
| agentensemble-viz-linux-x64.tar.gz | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Dispatch Homebrew formula update | |
| # Triggers update-formula.yml in AgentEnsemble/homebrew-tap to recompute | |
| # SHA256 hashes and commit the updated formula. Requires a PAT with | |
| # repo scope on homebrew-tap stored as ORG_HOMEBREW_TAP_TOKEN. | |
| run: | | |
| curl --silent --show-error --fail-with-body -X POST \ | |
| -H "Authorization: Bearer ${{ secrets.ORG_HOMEBREW_TAP_TOKEN }}" \ | |
| -H "Accept: application/vnd.github.v3+json" \ | |
| -H "Content-Type: application/json" \ | |
| https://api.github.com/repos/AgentEnsemble/homebrew-tap/dispatches \ | |
| --data "{\"event_type\":\"new-release\",\"client_payload\":{\"version\":\"${{ steps.version.outputs.version }}\"}}" | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Bump version to next SNAPSHOT | |
| run: | | |
| IFS='.' read -ra PARTS <<< "${{ steps.version.outputs.version }}" | |
| NEXT_PATCH=$((${PARTS[2]} + 1)) | |
| NEXT_VERSION="${PARTS[0]}.${PARTS[1]}.${NEXT_PATCH}" | |
| git fetch origin main | |
| git checkout main | |
| CURRENT_RAW=$(grep '^version=' gradle.properties | sed 's/version=//' | sed 's/-SNAPSHOT//') | |
| IFS='.' read -ra CUR <<< "${CURRENT_RAW}" | |
| SHOULD_BUMP=false | |
| if [ "${PARTS[0]}" -gt "${CUR[0]}" ]; then SHOULD_BUMP=true | |
| elif [ "${PARTS[0]}" -eq "${CUR[0]}" ] && [ "${PARTS[1]}" -gt "${CUR[1]}" ]; then SHOULD_BUMP=true | |
| elif [ "${PARTS[0]}" -eq "${CUR[0]}" ] && [ "${PARTS[1]}" -eq "${CUR[1]}" ] && [ "${NEXT_PATCH}" -gt "${CUR[2]}" ]; then SHOULD_BUMP=true | |
| fi | |
| if [ "${SHOULD_BUMP}" = true ]; then | |
| sed -i "s/^version=.*/version=${NEXT_VERSION}-SNAPSHOT/" gradle.properties | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add gradle.properties | |
| git commit -m "chore: bump version to ${NEXT_VERSION}-SNAPSHOT [skip ci]" | |
| git push origin main | |
| else | |
| echo "Current development version ${CURRENT_RAW}-SNAPSHOT is already ahead of ${NEXT_VERSION}; no bump needed." | |
| fi |