|
| 1 | + |
| 2 | +name: Maven Release |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + release_version: |
| 8 | + description: 'Release version (e.g. 1.2.0)' |
| 9 | + required: true |
| 10 | + type: string |
| 11 | + next_version: |
| 12 | + description: 'Next development version (e.g. 1.3.0-SNAPSHOT)' |
| 13 | + required: true |
| 14 | + type: string |
| 15 | + |
| 16 | +permissions: |
| 17 | + contents: write |
| 18 | + id-token: write |
| 19 | + |
| 20 | +env: |
| 21 | + AWS_REGION: us-west-2 |
| 22 | + |
| 23 | +jobs: |
| 24 | + release: |
| 25 | + runs-on: ubuntu-latest |
| 26 | + |
| 27 | + steps: |
| 28 | + - name: Checkout |
| 29 | + uses: actions/checkout@v4 |
| 30 | + with: |
| 31 | + fetch-depth: 0 |
| 32 | + |
| 33 | + - name: Setup Java |
| 34 | + uses: actions/setup-java@v4 |
| 35 | + with: |
| 36 | + java-version: '17' |
| 37 | + distribution: 'corretto' |
| 38 | + cache: maven |
| 39 | + |
| 40 | + - name: configure aws credentials |
| 41 | + uses: aws-actions/configure-aws-credentials@v6 |
| 42 | + with: |
| 43 | + role-to-assume: "${{ secrets.ACTIONS_MVN_ROLE_NAME }}" |
| 44 | + role-session-name: mavenreleasesession |
| 45 | + aws-region: ${{ env.AWS_REGION }} |
| 46 | + |
| 47 | + - name: Set release version |
| 48 | + run: mvn -q versions:set -DnewVersion=${{ github.event.inputs.release_version }} -DgenerateBackupPoms=false |
| 49 | + |
| 50 | + - name: Commit release version |
| 51 | + run: | |
| 52 | + git config user.email "${{ github.actor }}+github-actions[bot]@users.noreply.github.com" |
| 53 | + git config user.name "${{ github.actor }}+github-actions[bot]" |
| 54 | + git add . |
| 55 | + git commit -m "chore: release version ${{ github.event.inputs.release_version }}" |
| 56 | + |
| 57 | + - name: Push changes |
| 58 | + uses: ad-m/github-push-action@master |
| 59 | + with: |
| 60 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 61 | + |
| 62 | + - name: Create GitHub Release |
| 63 | + uses: softprops/action-gh-release@v2 |
| 64 | + with: |
| 65 | + tag_name: v${{ github.event.inputs.release_version }} |
| 66 | + name: Release v${{ github.event.inputs.release_version }} |
| 67 | + generate_release_notes: true |
| 68 | + |
| 69 | + - name: Get Env variables |
| 70 | + uses: aws-actions/aws-secretsmanager-get-secrets@v2 |
| 71 | + with: |
| 72 | + secret-ids: | |
| 73 | + mvn_gpg_keys |
| 74 | + mvn_account_keys |
| 75 | + parse-json-secrets: true |
| 76 | + |
| 77 | + - name: Sign and publish |
| 78 | + run: bash .github/scripts/maven_publish.sh |
| 79 | + env: |
| 80 | + RELEASE_VERSION: ${{ github.event.inputs.release_version }} |
| 81 | + |
| 82 | + - name: Set next development version |
| 83 | + run: mvn -q versions:set -DnewVersion=${{ github.event.inputs.next_version }} -DgenerateBackupPoms=false |
| 84 | + |
| 85 | + - name: Commit release version |
| 86 | + run: | |
| 87 | + git add . |
| 88 | + git commit -m "chore: bump version to ${{ github.event.inputs.next_version }}" |
| 89 | + |
| 90 | + - name: Push changes |
| 91 | + uses: ad-m/github-push-action@master |
| 92 | + with: |
| 93 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments