release 5.0.2 #105
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: [ 'release/**' ] | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| env: | |
| JRELEASER_MAVENCENTRAL_CENTRAL_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_CENTRAL_USERNAME }} | |
| JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }} | |
| JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }} | |
| JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }} | |
| JRELEASER_MAVENCENTRAL_CENTRAL_PASSWORD: ${{ secrets.JRELEASER_MAVENCENTRAL_CENTRAL_PASSWORD }} | |
| JRELEASER_GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build Workflow Dispatch | |
| uses: convictional/trigger-workflow-and-wait@v1.3.0 | |
| with: | |
| owner: LFDT-web3j | |
| repo: web3j | |
| github_token: ${{ secrets.JRELEASER_GITHUB_TOKEN }} | |
| workflow_file_name: build.yml | |
| wait_interval: 10 | |
| propagate_failure: true | |
| trigger_workflow: true | |
| wait_workflow: true | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'zulu' | |
| java-version: 21 | |
| - name: Cache Gradle packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.gradle/caches | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | |
| restore-keys: ${{ runner.os }}-gradle | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Extract release version from branch | |
| id: release_name | |
| run: | | |
| BRANCH="${GITHUB_REF##*/}" | |
| echo "version=$BRANCH" >> "$GITHUB_OUTPUT" | |
| - name: Fail if version is a SNAPSHOT | |
| if: endsWith(steps.release_name.outputs.version, '-SNAPSHOT') | |
| run: | | |
| echo "This workflow is for releases only. Version '${{ steps.release_name.outputs.version }}' ends with -SNAPSHOT." >&2 | |
| exit 1 | |
| # Publish artifacts to local staging repo (your Gradle config already defines it) | |
| - name: Stage artifacts locally | |
| run: ./gradlew -Pversion=${{ steps.release_name.outputs.version }} publishMavenPublicationToLocalStagingRepository --stacktrace | |
| # Deploy to Central Portal via JReleaser (Publisher API) | |
| - name: Deploy to Maven Central (Portal) | |
| run: ./gradlew -Pversion=${{ steps.release_name.outputs.version }} jreleaserDeploy --stacktrace | |
| javadocs-release: | |
| needs: release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: zulu | |
| java-version: 21 | |
| - name: Publish Javadocs (gh-pages) | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.JRELEASER_GITHUB_TOKEN }} | |
| run: ./gradlew core:gitPublishPush | |
| git-release: | |
| needs: release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Github Release | |
| uses: marvinpinto/action-automatic-releases@latest | |
| with: | |
| repo_token: ${{ secrets.JRELEASER_GITHUB_TOKEN }} | |
| automatic_release_tag: 'v${{ needs.release.outputs.stripped_version }}' | |
| prerelease: false | |
| files: | | |
| "web3j-unit-"+${{ steps.release_name.outputs.result }}.* |