Release Draft #2
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 Draft | |
| on: | |
| workflow_dispatch: # checkov:skip=CKV_GHA_7 | |
| inputs: | |
| bump-type: | |
| description: Version bump type | |
| required: true | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| create-release-pr: | |
| name: Create Release PR | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Read current version | |
| id: current-version | |
| run: echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT" | |
| - name: Bump version | |
| id: bump-version | |
| uses: actions-ecosystem/action-bump-semver@34e334551143a5301f38c830e44a22273c6ff5c5 # v1.0.0 | |
| with: | |
| current_version: ${{ steps.current-version.outputs.version }} | |
| level: ${{ github.event.inputs.bump-type || 'patch' }} | |
| - name: Write new version to VERSION | |
| run: echo "${{ steps.bump-version.outputs.new_version }}" > VERSION | |
| - name: Update README.md version references | |
| run: | | |
| sed -i "s/implementation 'com.mparticle:server-events-sdk:.*'/implementation 'com.mparticle:server-events-sdk:${{ steps.bump-version.outputs.new_version }}'/g" README.md | |
| sed -i "s/<version>.*<\/version>/<version>${{ steps.bump-version.outputs.new_version }}<\/version>/g" README.md | |
| - name: Update changelog | |
| uses: thomaseizinger/keep-a-changelog-new-release@f62c3c390716df5af712ba5d94f4f4a8efc1306d # v3.1.0 | |
| with: | |
| tag: ${{ steps.bump-version.outputs.new_version }} | |
| - name: Install JDK 17 | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: "zulu" | |
| java-version: "17" | |
| cache: "gradle" | |
| - name: Smoke test - publish to Maven local | |
| env: | |
| ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MAVEN_CENTRAL_SIGNING_KEY }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MAVEN_CENTRAL_SIGNING_KEY_PASSWORD }} | |
| run: ./gradlew publishToMavenLocal -PVERSION=${{ steps.bump-version.outputs.new_version }} | |
| - name: Create Pull Request | |
| uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0 | |
| with: | |
| token: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }} | |
| commit-message: "chore: prepare release ${{ steps.bump-version.outputs.new_version }}" | |
| branch: release/${{ steps.bump-version.outputs.new_version }} | |
| title: "chore: release ${{ steps.bump-version.outputs.new_version }}" | |
| base: main | |
| body: | | |
| ## Release ${{ steps.bump-version.outputs.new_version }} | |
| These files should have changed during the release, if they didn't then this is likely an issue and should be investigated: | |
| - VERSION | |
| - README.md | |
| - CHANGELOG.md |