release: v0.8.1 — 66 inspectors / 246 tools (+2 new inspectors, +20 e… #11
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 to Maven Central | |
| # Trigger: push a tag like v0.2.0 | |
| # The tag name IS the source of truth — the workflow overrides all POM versions to match. | |
| # After a successful release, the POM version on main is bumped to the next SNAPSHOT. | |
| # | |
| # Usage: | |
| # git tag v0.2.0 | |
| # git push origin v0.2.0 | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: maven | |
| # ── Step 1: Extract version from tag ───────────────────────── | |
| - name: Extract version from tag | |
| id: version | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$'; then | |
| echo "::error::Invalid version format: $VERSION" | |
| echo "::error::Tag must be vX.Y.Z (e.g., v0.2.0, v1.0.0-RC1)" | |
| exit 1 | |
| fi | |
| echo "release_version=$VERSION" >> $GITHUB_OUTPUT | |
| MAJOR=$(echo "$VERSION" | cut -d. -f1) | |
| MINOR=$(echo "$VERSION" | cut -d. -f2) | |
| PATCH=$(echo "$VERSION" | cut -d. -f3 | cut -d- -f1) | |
| NEXT_PATCH=$((PATCH + 1)) | |
| echo "snapshot_version=${MAJOR}.${MINOR}.${NEXT_PATCH}-SNAPSHOT" >> $GITHUB_OUTPUT | |
| echo "::notice::Releasing $VERSION" | |
| # ── Step 2: Set release version via mvn versions:set ───────── | |
| - name: Set release version | |
| run: | | |
| VERSION="${{ steps.version.outputs.release_version }}" | |
| echo "Setting agent version to $VERSION" | |
| # Agent is standalone — use mvn versions:set directly | |
| mvn versions:set -DnewVersion=$VERSION -DgenerateBackupPoms=false \ | |
| -f agent/pom.xml -q | |
| # Verify | |
| echo "=== agent/pom.xml version ===" | |
| grep -m1 "<version>" agent/pom.xml | |
| # ── Step 3: Import GPG key ─────────────────────────────────── | |
| - name: Import GPG key | |
| run: | | |
| echo "${{ secrets.GPG_PRIVATE_KEY }}" | gpg --dearmor --output /tmp/signing-key.gpg | |
| gpg --batch --import /tmp/signing-key.gpg | |
| rm -f /tmp/signing-key.gpg | |
| gpg --list-secret-keys --keyid-format=long | |
| # ── Step 4: Configure Maven settings ───────────────────────── | |
| - name: Configure Maven settings | |
| run: | | |
| mkdir -p ~/.m2 | |
| cat > ~/.m2/settings.xml << 'SETTINGS' | |
| <settings> | |
| <servers> | |
| <server> | |
| <id>central</id> | |
| <username>${env.SONATYPE_USERNAME}</username> | |
| <password>${env.SONATYPE_TOKEN}</password> | |
| </server> | |
| </servers> | |
| </settings> | |
| SETTINGS | |
| # ── Step 5: Build, Sign, Deploy ────────────────────────────── | |
| - name: Deploy to Maven Central | |
| run: | | |
| mvn clean deploy -DskipTests \ | |
| -Prelease \ | |
| -Dgpg.passphrase="" \ | |
| -B -V \ | |
| -f agent/pom.xml | |
| env: | |
| MAVEN_OPTS: "-Xmx2g" | |
| SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
| SONATYPE_TOKEN: ${{ secrets.SONATYPE_TOKEN }} | |
| # ── Step 6: Bump to next SNAPSHOT ──────────────────────────── | |
| - name: Bump to next SNAPSHOT | |
| run: | | |
| SNAPSHOT="${{ steps.version.outputs.snapshot_version }}" | |
| mvn versions:set -DnewVersion=$SNAPSHOT -DgenerateBackupPoms=false \ | |
| -f agent/pom.xml -q | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add agent/pom.xml | |
| git commit -m "chore: bump version to $SNAPSHOT [skip ci]" | |
| git push origin HEAD:main | |
| # ── Step 7: Create GitHub Release ──────────────────────────── | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: ${{ github.ref_name }} | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: ${{ contains(steps.version.outputs.release_version, '-') }} | |
| body: | | |
| ## Maven Central | |
| ```xml | |
| <dependency> | |
| <groupId>dev.ggcode</groupId> | |
| <artifactId>spring-debug-agent</artifactId> | |
| <version>${{ steps.version.outputs.release_version }}</version> | |
| </dependency> | |
| ``` | |
| Gradle: | |
| ```groovy | |
| implementation 'dev.ggcode:spring-debug-agent:${{ steps.version.outputs.release_version }}' | |
| ``` |