|
| 1 | +name: Release new version |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + push: |
| 7 | + description: 'Push artifacts to Central and commits to the repository' |
| 8 | + required: true |
| 9 | + default: true |
| 10 | + type: 'boolean' |
| 11 | + |
| 12 | +jobs: |
| 13 | + release: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + permissions: |
| 16 | + contents: write |
| 17 | + packages: write |
| 18 | + env: |
| 19 | + STAGED_REPOSITORY: target/checkout/target/staging-deploy |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Check if release is running from master |
| 23 | + run: | |
| 24 | + if [ "${GITHUB_REF}" != "refs/heads/master" ]; then |
| 25 | + echo "Release is only allowed from master branch" |
| 26 | + exit 1 |
| 27 | + fi |
| 28 | +
|
| 29 | + - name: Checkout code |
| 30 | + uses: actions/checkout@v4 |
| 31 | + with: |
| 32 | + fetch-depth: 0 |
| 33 | + |
| 34 | + - name: Install java |
| 35 | + uses: actions/setup-java@v4 |
| 36 | + with: |
| 37 | + java-version: '23' |
| 38 | + distribution: 'temurin' |
| 39 | + gpg-private-key: ${{ secrets.JRELEASER_GPG_SECRET_KEY }} |
| 40 | + gpg-passphrase: MAVEN_GPG_PASSPHRASE |
| 41 | + cache: 'maven' |
| 42 | + |
| 43 | + - name: Configure git |
| 44 | + run: | |
| 45 | + git config user.name "Trino Release" |
| 46 | + git config user.email "[email protected]" |
| 47 | +
|
| 48 | + - name: Lock branch before release |
| 49 | + uses: github/lock@v2 |
| 50 | + id: release-lock |
| 51 | + with: |
| 52 | + mode: 'lock' |
| 53 | + |
| 54 | + - name: Run mvn release:prepare |
| 55 | + env: |
| 56 | + MAVEN_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }} |
| 57 | + run: | |
| 58 | + ./mvnw -B release:prepare -Poss-release,oss-stage |
| 59 | +
|
| 60 | + - name: Determine release version |
| 61 | + run: | |
| 62 | + export VERSION=$(grep 'scm.tag=' release.properties | cut -d'=' -f2) |
| 63 | + echo "VERSION=${VERSION}" >> $GITHUB_ENV |
| 64 | + echo "Releasing version: ${VERSION}" |
| 65 | +
|
| 66 | + - name: Run mvn release:perform to local staging |
| 67 | + env: |
| 68 | + MAVEN_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }} |
| 69 | + run: | |
| 70 | + ./mvnw -B release:perform -Poss-release,oss-stage |
| 71 | +
|
| 72 | + - name: Display git status and history |
| 73 | + run: | |
| 74 | + git status |
| 75 | + git log --oneline -n 2 |
| 76 | +
|
| 77 | + - name: List locally staged artifacts |
| 78 | + run: | |
| 79 | + find ${{ env.STAGED_REPOSITORY }} -type f |
| 80 | +
|
| 81 | + - name: Run JReleaser |
| 82 | + uses: jreleaser/release-action@v2 |
| 83 | + env: |
| 84 | + JRELEASER_PROJECT_VERSION: ${{ env.VERSION }} |
| 85 | + JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 86 | + JRELEASER_GPG_PUBLIC_KEY: ${{ vars.JRELEASER_GPG_PUBLIC_KEY }} |
| 87 | + JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }} |
| 88 | + JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }} |
| 89 | + JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME: ${{ secrets.JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME }} |
| 90 | + JRELEASER_NEXUS2_MAVEN_CENTRAL_TOKEN: ${{ secrets.JRELEASER_NEXUS2_MAVEN_CENTRAL_TOKEN }} |
| 91 | + JRELEASER_NEXUS2_END_STAGE: ${{ inputs.push && 'RELEASE' || 'CLOSE' }} |
| 92 | + JRELEASER_SKIP_RELEASE: ${{ inputs.push && 'false' || 'true' }} |
| 93 | + with: |
| 94 | + setup-java: false |
| 95 | + |
| 96 | + - name: Push git changes |
| 97 | + if: ${{ inputs.push }} |
| 98 | + run: | |
| 99 | + git status |
| 100 | + git push origin master |
| 101 | +
|
| 102 | + - name: Unlock branch after a release |
| 103 | + uses: github/lock@v2 |
| 104 | + id: release-unlock |
| 105 | + with: |
| 106 | + mode: 'unlock' |
| 107 | + |
| 108 | + - name: Upload JReleaser logs |
| 109 | + if: always() |
| 110 | + uses: actions/upload-artifact@v4 |
| 111 | + with: |
| 112 | + name: jreleaser-logs |
| 113 | + path: | |
| 114 | + out/jreleaser/trace.log |
| 115 | + out/jreleaser/output.properties |
0 commit comments