feat: rebuild Java Process Inspector as JPI v2 #1
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*.*.*" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| release: | |
| runs-on: windows-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Java 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: "21" | |
| cache: maven | |
| - name: Verify release version | |
| shell: pwsh | |
| run: | | |
| [xml]$pom = Get-Content -Raw pom.xml | |
| $version = [string]$pom.project.version | |
| if ([string]::IsNullOrWhiteSpace($version)) { | |
| throw "Project version is missing from pom.xml" | |
| } | |
| if ($version.EndsWith("-SNAPSHOT")) { | |
| throw "Release version cannot end with -SNAPSHOT: $version" | |
| } | |
| if ("${{ github.event_name }}" -eq "push") { | |
| $expectedTag = "v$version" | |
| if ($env:GITHUB_REF_NAME -ne $expectedTag) { | |
| throw "Tag $($env:GITHUB_REF_NAME) does not match pom.xml version $expectedTag" | |
| } | |
| } | |
| "JPI_VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| "Validated JPI version $version" | Add-Content $env:GITHUB_STEP_SUMMARY | |
| - name: Verify source comment policy | |
| shell: pwsh | |
| run: powershell -NoProfile -ExecutionPolicy Bypass -File tools/check-no-comments.ps1 | |
| - name: Run unit and attach integration tests | |
| run: mvn --batch-mode --no-transfer-progress clean verify | |
| - name: Validate packaged application | |
| shell: pwsh | |
| run: | | |
| $jar = "target/jpi.jar" | |
| if (-not (Test-Path $jar)) { | |
| throw "Release JAR was not produced: $jar" | |
| } | |
| $entries = @(& jar tf $jar) | |
| $required = @( | |
| "META-INF/MANIFEST.MF", | |
| "dev/whitedev/jpi/JpiApplication.class", | |
| "dev/whitedev/jpi/agent/InspectorAgent.class", | |
| "org/objectweb/asm/tree/ClassNode.class", | |
| "org/eclipse/jdt/internal/compiler/tool/EclipseCompiler.class", | |
| "javax/annotation/Nullable.class", | |
| "assets/cfr-0.152.jar", | |
| "assets/vineflower-1.12.0.jar", | |
| "assets/procyon-compilertools-0.6.0.jar", | |
| "assets/procyon-core-0.6.0.jar" | |
| ) | |
| foreach ($entry in $required) { | |
| if ($entries -notcontains $entry) { | |
| throw "Release JAR is missing $entry" | |
| } | |
| } | |
| "Validated shaded JAR contents" | Add-Content $env:GITHUB_STEP_SUMMARY | |
| - name: Stage release artifacts | |
| shell: pwsh | |
| run: | | |
| New-Item -ItemType Directory -Force dist | Out-Null | |
| $name = "jpi-v$($env:JPI_VERSION).jar" | |
| $artifact = Join-Path "dist" $name | |
| Copy-Item "target/jpi.jar" $artifact | |
| $hash = (Get-FileHash $artifact -Algorithm SHA256).Hash.ToLowerInvariant() | |
| "$hash $name" | Set-Content -Encoding ascii "$artifact.sha256" | |
| "Artifact: $name" | Add-Content $env:GITHUB_STEP_SUMMARY | |
| "SHA-256: $hash" | Add-Content $env:GITHUB_STEP_SUMMARY | |
| - name: Upload workflow artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: jpi-v${{ env.JPI_VERSION }}-windows | |
| path: dist/* | |
| if-no-files-found: error | |
| retention-days: 30 | |
| - name: Build changelog from commits | |
| if: github.event_name == 'push' | |
| shell: pwsh | |
| run: | | |
| $currentTag = $env:GITHUB_REF_NAME | |
| $previousTag = git tag --merged $currentTag --sort=-version:refname | | |
| Where-Object { $_ -ne $currentTag } | | |
| Select-Object -First 1 | |
| $range = if ($previousTag) { "$previousTag..$currentTag" } else { $currentTag } | |
| $commits = @(git log --reverse --pretty=format:"- %s (%h)" $range) | |
| $lines = @( | |
| "## Changelog", | |
| "" | |
| ) | |
| if ($previousTag) { | |
| $lines += "Changes since $previousTag:" | |
| } else { | |
| $lines += "Changes included in the first tagged release:" | |
| } | |
| $lines += "" | |
| if ($commits.Count -eq 0) { | |
| $lines += "- No commit messages found" | |
| } else { | |
| $lines += $commits | |
| } | |
| $lines += "" | |
| $notesPath = Join-Path $env:RUNNER_TEMP "release-notes.md" | |
| [IO.File]::WriteAllLines($notesPath, $lines, [Text.UTF8Encoding]::new($false)) | |
| "RELEASE_NOTES_PATH=$notesPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Create GitHub release | |
| if: github.event_name == 'push' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: JPI ${{ github.ref_name }} | |
| body_path: ${{ env.RELEASE_NOTES_PATH }} | |
| files: dist/* | |
| fail_on_unmatched_files: true | |
| prerelease: ${{ contains(github.ref_name, '-') }} |