|
| 1 | +name: Release Draft |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: # checkov:skip=CKV_GHA_7 |
| 5 | + inputs: |
| 6 | + bump-type: |
| 7 | + description: Version bump type |
| 8 | + required: true |
| 9 | + type: choice |
| 10 | + options: |
| 11 | + - patch |
| 12 | + - minor |
| 13 | + - major |
| 14 | + |
| 15 | +concurrency: |
| 16 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 17 | + cancel-in-progress: true |
| 18 | + |
| 19 | +permissions: |
| 20 | + contents: write |
| 21 | + pull-requests: write |
| 22 | + |
| 23 | +jobs: |
| 24 | + create-release-pr: |
| 25 | + name: Create Release PR |
| 26 | + runs-on: ubuntu-latest |
| 27 | + steps: |
| 28 | + - name: Checkout |
| 29 | + uses: actions/checkout@v4 |
| 30 | + with: |
| 31 | + fetch-depth: 0 |
| 32 | + |
| 33 | + - name: Read current version |
| 34 | + id: current-version |
| 35 | + run: echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT" |
| 36 | + |
| 37 | + - name: Bump version |
| 38 | + id: bump-version |
| 39 | + uses: actions-ecosystem/action-bump-semver@34e334551143a5301f38c830e44a22273c6ff5c5 # v1.0.0 |
| 40 | + with: |
| 41 | + current_version: ${{ steps.current-version.outputs.version }} |
| 42 | + level: ${{ github.event.inputs.bump-type || 'patch' }} |
| 43 | + |
| 44 | + - name: Write new version to VERSION |
| 45 | + run: echo "${{ steps.bump-version.outputs.new_version }}" > VERSION |
| 46 | + |
| 47 | + - name: Update README.md version references |
| 48 | + run: | |
| 49 | + sed -i "s/implementation 'com.mparticle:server-events-sdk:.*'/implementation 'com.mparticle:server-events-sdk:${{ steps.bump-version.outputs.new_version }}'/g" README.md |
| 50 | + sed -i "s/<version>.*<\/version>/<version>${{ steps.bump-version.outputs.new_version }}<\/version>/g" README.md |
| 51 | +
|
| 52 | + - name: Update changelog |
| 53 | + uses: thomaseizinger/keep-a-changelog-new-release@f62c3c390716df5af712ba5d94f4f4a8efc1306d # v3.1.0 |
| 54 | + with: |
| 55 | + tag: ${{ steps.bump-version.outputs.new_version }} |
| 56 | + |
| 57 | + - name: Install JDK 17 |
| 58 | + uses: actions/setup-java@v5 |
| 59 | + with: |
| 60 | + distribution: "zulu" |
| 61 | + java-version: "17" |
| 62 | + cache: "gradle" |
| 63 | + |
| 64 | + - name: Smoke test - publish to Maven local |
| 65 | + run: ./gradlew publishToMavenLocal -PVERSION=${{ steps.bump-version.outputs.new_version }} |
| 66 | + |
| 67 | + - name: Create Pull Request |
| 68 | + uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0 |
| 69 | + with: |
| 70 | + token: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }} |
| 71 | + commit-message: "chore: prepare release ${{ steps.bump-version.outputs.new_version }}" |
| 72 | + branch: release/${{ steps.bump-version.outputs.new_version }} |
| 73 | + title: "chore: release ${{ steps.bump-version.outputs.new_version }}" |
| 74 | + base: main |
| 75 | + body: | |
| 76 | + ## Release ${{ steps.bump-version.outputs.new_version }} |
| 77 | +
|
| 78 | + These files should have changed during the release, if they didn't then this is likely an issue and should be investigated: |
| 79 | + - VERSION |
| 80 | + - README.md |
| 81 | + - CHANGELOG.md |
0 commit comments