Skip to content

Commit d35b3e0

Browse files
rmi22186claude
andcommitted
ci: Update release process
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d2ab3d2 commit d35b3e0

File tree

6 files changed

+214
-259
lines changed

6 files changed

+214
-259
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Release Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- VERSION
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
unit-test:
15+
name: Unit Tests
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Install JDK 17
22+
uses: actions/setup-java@v5
23+
with:
24+
distribution: "zulu"
25+
java-version: "17"
26+
cache: "gradle"
27+
28+
- name: Run tests
29+
run: ./gradlew test
30+
31+
publish:
32+
name: Publish to Maven Central
33+
needs: unit-test
34+
runs-on: ubuntu-latest
35+
env:
36+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MAVEN_CENTRAL_SIGNING_KEY }}
37+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MAVEN_CENTRAL_SIGNING_KEY_PASSWORD }}
38+
sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
39+
sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
40+
steps:
41+
- name: Checkout
42+
uses: actions/checkout@v4
43+
44+
- name: Read version from VERSION
45+
id: version
46+
run: echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT"
47+
48+
- name: Install JDK 17
49+
uses: actions/setup-java@v5
50+
with:
51+
distribution: "zulu"
52+
java-version: "17"
53+
cache: "gradle"
54+
55+
- name: Publish to Maven Central
56+
run: ./gradlew publishMavenPublicationToSonatypeRepository -PVERSION=${{ steps.version.outputs.version }}
57+
58+
create-github-release:
59+
name: Create GitHub Release
60+
needs: [publish]
61+
runs-on: ubuntu-latest
62+
steps:
63+
- name: Checkout
64+
uses: actions/checkout@v4
65+
66+
- name: Read version from VERSION
67+
id: version
68+
run: echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT"
69+
70+
- name: Extract release notes from CHANGELOG.md
71+
id: release-notes
72+
uses: ffurrer2/extract-release-notes@273da39a24fb7db106a35526c8162815faffd31d # v3.1.0
73+
with:
74+
changelog_file: CHANGELOG.md
75+
76+
- name: Create GitHub Release
77+
uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b # v1.20.0
78+
with:
79+
makeLatest: true
80+
allowUpdates: true
81+
tag: v${{ steps.version.outputs.version }}
82+
name: v${{ steps.version.outputs.version }}
83+
body: ${{ steps.release-notes.outputs.release_notes }}
84+
commit: ${{ github.sha }}

.github/workflows/release.yml

Lines changed: 0 additions & 114 deletions
This file was deleted.

0 commit comments

Comments
 (0)