Bump version to 0.3.12 #34
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 | |
| packages: write | |
| pull-requests: write | |
| jobs: | |
| # Extract version from tag | |
| prepare: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| version_tag: ${{ steps.version.outputs.tag }} | |
| steps: | |
| - name: Extract version | |
| id: version | |
| run: | | |
| TAG="${{ github.ref_name }}" | |
| VERSION="${TAG#v}" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "tag=$TAG" >> $GITHUB_OUTPUT | |
| echo "Release version: $VERSION" | |
| # Publish core artifacts to Sonatype | |
| publish-maven: | |
| needs: prepare | |
| runs-on: ubuntu-latest | |
| env: | |
| ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALUSERNAME }} | |
| ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALPASSWORD }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEY }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEYID }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEYPASSWORD }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v3 | |
| - name: Verify version matches tag | |
| run: | | |
| PROJECT_VERSION=$(grep "^project.version=" build.gradle | cut -d'"' -f2) | |
| if [ "$PROJECT_VERSION" != "${{ needs.prepare.outputs.version }}" ]; then | |
| echo "ERROR: Project version ($PROJECT_VERSION) doesn't match tag version (${{ needs.prepare.outputs.version }})" | |
| exit 1 | |
| fi | |
| - name: Publish parser to Maven Local (for gradle plugin dependency) | |
| run: | | |
| ./gradlew :parser:jar :parser:sourcesJar :parser:publishToMavenLocal --no-daemon --stacktrace | |
| - name: Publish parser, tools, jfr-shell to Maven Central | |
| run: | | |
| ./gradlew :parser:publishAllPublicationsToMavenCentralRepository :tools:publishAllPublicationsToMavenCentralRepository :jfr-shell:shadowJar :jfr-shell:publishAllPublicationsToMavenCentralRepository --no-daemon --stacktrace | |
| - name: Publish gradle plugin to Maven Central and GitHub Packages | |
| run: | | |
| cd jafar-gradle-plugin | |
| ./gradlew publishAllPublicationsToMavenCentralRepository publishAllPublicationsToGitHubPackagesRepository --no-daemon --stacktrace | |
| env: | |
| ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALUSERNAME }} | |
| ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALPASSWORD }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEY }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEYID }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEYPASSWORD }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_ACTOR: ${{ github.actor }} | |
| # Update JBang catalog automatically | |
| update-jbang-catalog: | |
| needs: [prepare, publish-maven] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout jbang-catalog | |
| continue-on-error: true | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: btraceio/jbang-catalog | |
| token: ${{ secrets.JBANG_CATALOG_PAT || secrets.GITHUB_TOKEN }} | |
| path: catalog | |
| - name: Update catalog files | |
| run: | | |
| VERSION="${{ needs.prepare.outputs.version }}" | |
| TAG="${{ needs.prepare.outputs.version_tag }}" | |
| cd catalog | |
| # Update jbang-catalog.json | |
| sed -i.bak "s|io.btrace:jafar-shell:[^\"]*|io.btrace:jafar-shell:$VERSION|g" jbang-catalog.json | |
| # Update jfr-shell.java | |
| sed -i.bak "s|//DEPS io.btrace:jafar-shell:.*|//DEPS io.btrace:jafar-shell:$VERSION|g" jfr-shell.java | |
| # Clean up backup files | |
| rm -f *.bak | |
| # Show changes | |
| git diff | |
| - name: Commit and push catalog updates | |
| continue-on-error: true | |
| run: | | |
| VERSION="${{ needs.prepare.outputs.version }}" | |
| if [ ! -d catalog ]; then | |
| echo "⚠️ Catalog checkout failed - skipping update" | |
| echo "Add JBANG_CATALOG_PAT secret to enable automatic catalog updates" | |
| exit 0 | |
| fi | |
| cd catalog | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add jbang-catalog.json jfr-shell.java | |
| if git commit -m "Update jfr-shell to version $VERSION"; then | |
| git push || echo "⚠️ Push failed - update catalog manually at https://github.com/btraceio/jbang-catalog" | |
| fi | |
| # Create GitHub Release with notes | |
| create-release: | |
| needs: [prepare, publish-maven] | |
| if: always() && !cancelled() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Extract changelog for this version | |
| id: changelog | |
| run: | | |
| VERSION="${{ needs.prepare.outputs.version }}" | |
| # Extract changelog section for this version | |
| awk "/## \[$VERSION\]/,/## \[/{if(/## \[/ && !/## \[$VERSION\]/)exit;print}" CHANGELOG.md > /tmp/release-notes.md | |
| # If empty, use a default message | |
| if [ ! -s /tmp/release-notes.md ]; then | |
| echo "Release $VERSION" > /tmp/release-notes.md | |
| fi | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ needs.prepare.outputs.version_tag }} | |
| name: Release ${{ needs.prepare.outputs.version }} | |
| body_path: /tmp/release-notes.md | |
| files: | | |
| **/build/libs/*.jar | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Add release comment | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const version = '${{ needs.prepare.outputs.version }}'; | |
| const tag = '${{ needs.prepare.outputs.version_tag }}'; | |
| const body = `## 🎉 Release ${version} Published Successfully | |
| This release has been published to: | |
| - ✅ Maven Central (Sonatype): \`io.btrace:jafar-parser:${version}\`, \`io.btrace:jafar-tools:${version}\`, \`io.btrace:jafar-shell:${version}\`, \`io.btrace:jafar-gradle-plugin:${version}\` | |
| - ✅ GitHub Packages: \`io.btrace:jafar-gradle-plugin:${version}\` (available immediately while waiting for Maven Central approval) | |
| - ✅ JBang Catalog: Updated to ${version} | |
| ### Usage | |
| **Via JBang (recommended):** | |
| \`\`\`bash | |
| # Using catalog (always latest) | |
| jbang jfr-shell@btraceio recording.jfr | |
| # Version pinned (from Maven Central) | |
| jbang io.btrace:jafar-shell:${version} recording.jfr | |
| # Install as command | |
| jbang app install jfr-shell@btraceio | |
| jfr-shell recording.jfr | |
| \`\`\` | |
| **Via Maven/Gradle:** | |
| \`\`\`xml | |
| <!-- Parser --> | |
| <dependency> | |
| <groupId>io.btrace</groupId> | |
| <artifactId>jafar-parser</artifactId> | |
| <version>${version}</version> | |
| </dependency> | |
| <!-- JFR Shell --> | |
| <dependency> | |
| <groupId>io.btrace</groupId> | |
| <artifactId>jafar-shell</artifactId> | |
| <version>${version}</version> | |
| </dependency> | |
| \`\`\` | |
| **Gradle Plugin:** | |
| \`\`\`gradle | |
| plugins { | |
| id 'io.btrace.jafar-gradle-plugin' version '${version}' | |
| } | |
| \`\`\` | |
| ### Links | |
| - 📦 [Maven Central](https://central.sonatype.com/artifact/io.btrace/jafar-parser/${version}) | |
| - 📦 [GitHub Packages](https://github.com/btraceio/jafar/packages) | |
| - 📚 [Documentation](https://github.com/btraceio/jafar#readme) | |
| - 🔖 [Changelog](https://github.com/btraceio/jafar/blob/${tag}/CHANGELOG.md)`; | |
| // Find the release and add a comment | |
| const releases = await github.rest.repos.listReleases({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| }); | |
| const release = releases.data.find(r => r.tag_name === tag); | |
| if (release) { | |
| await github.rest.repos.updateRelease({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| release_id: release.id, | |
| body: release.body + '\n\n' + body | |
| }); | |
| } |