Repository navigation
chore(main): release judoscale-java 0.1.4 (#8) #15
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: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| inputs: | |
| dry_run: | |
| description: "Dry run (skip actual publish)" | |
| type: boolean | |
| default: true | |
| jobs: | |
| release-please: | |
| name: Create a release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| release_created: ${{ steps.release.outputs.release_created }} | |
| version: ${{ steps.release.outputs.version }} | |
| pr: ${{ steps.release.outputs.pr }} | |
| steps: | |
| - name: Release | |
| id: release | |
| uses: googleapis/release-please-action@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Checkout code | |
| if: ${{ steps.release.outputs.pr != '' }} | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ fromJson(steps.release.outputs.pr).headBranchName }} | |
| - name: Update README versions | |
| if: ${{ steps.release.outputs.pr != '' }} | |
| run: | | |
| VERSION=$(cat version.txt) | |
| # Update Maven examples (all version tags) | |
| sed -i "s|<version>[0-9]*\.[0-9]*\.[0-9]*</version>|<version>${VERSION}</version>|g" README.md | |
| # Update Gradle examples (both starters) | |
| sed -i "s|judoscale-spring-boot-starter:[0-9]*\.[0-9]*\.[0-9]*|judoscale-spring-boot-starter:${VERSION}|g" README.md | |
| sed -i "s|judoscale-spring-boot-2-starter:[0-9]*\.[0-9]*\.[0-9]*|judoscale-spring-boot-2-starter:${VERSION}|g" README.md | |
| - name: Commit version updates | |
| if: ${{ steps.release.outputs.pr != '' }} | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add README.md | |
| git diff --staged --quiet || git commit -m "chore: update README versions to ${VERSION}" | |
| git push | |
| publish: | |
| name: Publish to Maven Central | |
| needs: release-please | |
| runs-on: ubuntu-latest | |
| if: ${{ needs.release-please.outputs.release_created == 'true' }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: "21" | |
| distribution: "temurin" | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v3 | |
| - name: Build | |
| run: ./gradlew build | |
| - name: Publish to Maven Central | |
| if: ${{ inputs.dry_run != true }} | |
| env: | |
| ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
| ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_SIGNING_KEY }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_SIGNING_PASSWORD }} | |
| run: ./gradlew publishToMavenCentral | |
| - name: Publish dry run | |
| if: ${{ inputs.dry_run == true }} | |
| env: | |
| ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_SIGNING_KEY }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_SIGNING_PASSWORD }} | |
| run: | | |
| echo "Dry run - publishing to local repository only" | |
| ./gradlew publishToMavenLocal | |
| echo "Would publish these artifacts:" | |
| find ~/.m2/repository/com/judoscale -type f -name "*.jar" -o -name "*.pom" | head -20 |