-
Notifications
You must be signed in to change notification settings - Fork 71
168 lines (142 loc) · 6.61 KB
/
release-draft.yml
File metadata and controls
168 lines (142 loc) · 6.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: Release – Draft
# Ensure the manual release process only starts from the main branch.
# Bump ecosystem versions and open a release PR that triggers publish-on-main after merge.
on:
workflow_dispatch:
inputs:
bump-type:
description: "Version bump type"
required: true
type: choice
options:
- patch
- minor
- major
jobs:
confirm-main-branch:
name: Confirm release is run from main branch
uses: mParticle/mparticle-workflows/.github/workflows/sdk-release-repo-branch-check.yml@stable
release:
name: Create release PR
runs-on: macOS-latest
needs: confirm-main-branch
env:
GITHUB_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }}
steps:
- name: Checkout main branch
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }}
ref: main
- name: Get current version from latest tag
id: current-version
run: |
CURRENT_VERSION=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "0.0.0")
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
- name: Bump version
id: bump-version
uses: actions-ecosystem/action-bump-semver@v1
with:
current_version: ${{ steps.current-version.outputs.version }}
level: ${{ github.event.inputs.bump-type }}
- name: Set version environment variables
run: |
VERSION=$(echo "${{ steps.bump-version.outputs.new_version }}" | sed 's/^v//')
MAJOR=$(echo "$VERSION" | cut -d. -f1)
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "MAJOR=$MAJOR" >> $GITHUB_ENV
echo "📌 ${{ steps.current-version.outputs.version }} → $VERSION (${{ github.event.inputs.bump-type }})"
- name: Setup git config
run: |
git config user.email "developers@mparticle.com"
git config user.name "mParticle Automation"
- name: Create release branch
run: |
git push origin --delete chore/release-v${VERSION} 2>/dev/null || true
git checkout -b chore/release-v${VERSION}
- name: Update VERSION file
run: echo "$VERSION" > VERSION
- name: Update version in all podspecs
run: |
PODSPECS=(
"mParticle-Apple-SDK.podspec"
"mParticle-Apple-SDK-ObjC.podspec"
"mParticle-Apple-SDK-Swift.podspec"
)
while IFS= read -r spec; do
PODSPECS+=("$spec")
done < <(jq -r '.[] | select(.podspec) | .podspec' Kits/matrix.json)
for podspec in "${PODSPECS[@]}"; do
sed -i '' 's/\(s\.version[^=]*=[[:space:]]*\)"[^"]*"/\1"'"${VERSION}"'"/' "$podspec"
done
- name: Update version in MPIConstants.m
run: sed -i '' "s/kMParticleSDKVersion = @\"[^\"]*\"/kMParticleSDKVersion = @\"${VERSION}\"/" mParticle-Apple-SDK/MPIConstants.m
- name: Update hardcoded version strings in kit source files
run: |
sed -i '' "s/kMPRoktKitVersion = @\"[^\"]*\"/kMPRoktKitVersion = @\"${VERSION}\"/" \
Kits/rokt/rokt/Sources/mParticle-Rokt/MPKitRokt.m
sed -i '' "s/kLibVersion = @\"[^\"]*\"/kLibVersion = @\"${VERSION}\"/" \
Kits/clevertap/clevertap-7/Sources/mParticle-CleverTap/MPKitCleverTap.m
sed -i '' "s/registerPluginName:@\"mParticleKit\" version:@\"[^\"]*\"/registerPluginName:@\"mParticleKit\" version:@\"${VERSION}\"/" \
Kits/branchmetrics/branchmetrics-3/Sources/mParticle-BranchMetrics/MPKitBranchMetrics.m
- name: Update version in Info.plist
run: /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${VERSION}" Framework/Info.plist
- name: Update kit dependency on core SDK for major release
if: github.event.inputs.bump-type == 'major'
run: |
# Podspec: '~> X.Y' → '~> MAJOR.0' (handles with or without /mParticle subspec)
find Kits -name "*.podspec" -exec \
sed -i '' "s/\('mParticle-Apple-SDK[^']*'\), '~> [^']*'/\1, '~> ${MAJOR}.0'/" {} +
# Kit Package.swift: each kit uses `let version` + mParticleAppleSDK (branch main if empty,
# else .upToNextMajor(from: Version(version)!)). Set to the new ecosystem semver on major bump.
find Kits -name "Package.swift" -exec \
sed -i '' 's/^let version = "[^"]*"/let version = "'"${VERSION}"'"/' {} +
- name: Generate changelog entry
id: changelog
uses: ROKT/rokt-workflows/actions/generate-changelog@main
with:
version: ${{ env.VERSION }}
repo-url: https://github.com/${{ github.repository }}
tag-prefix: v
changelog-path: CHANGELOG.md
exclude-types: chore,ci,test,build
kits-path: Kits
# --- Commit, push, and create PR ---
- name: Commit version changes
run: |
git add \
CHANGELOG.md \
VERSION \
Framework/Info.plist \
mParticle-Apple-SDK.podspec \
mParticle-Apple-SDK-ObjC.podspec \
mParticle-Apple-SDK-Swift.podspec \
mParticle-Apple-SDK/MPIConstants.m \
IntegrationTests/wiremock-recordings/mappings/*.json \
Kits/
git commit -m "chore: (release) ${VERSION}
Updates version to ${VERSION} across the mParticle ecosystem."
- name: Push release branch
run: git push origin chore/release-v${VERSION}
- name: Create Pull Request
env:
GH_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }}
run: |
gh pr create \
--base main \
--head chore/release-v${VERSION} \
--title "chore: Release v${VERSION}" \
--body "## Release v${VERSION}
### Bump type: \`${{ github.event.inputs.bump-type }}\`
This PR contains the version bump for release ${VERSION}.
### Files updated
- All podspecs (core, Swift, kits) → \`${VERSION}\`
- \`mParticle-Apple-SDK/MPIConstants.m\`
- Kit source version strings (Rokt \`kMPRoktKitVersion\`, CleverTap \`kLibVersion\`, Branch \`registerPluginName\`)
- \`Framework/Info.plist\`
- Integration test mappings
- Kit \`Package.swift\`: \`let version\` → core SDK SPM pin (major bumps only)
---
**On merge:** The [Release – Publish](https://github.com/${{ github.repository }}/actions/workflows/release-publish.yml) workflow will automatically build, tag, and create GitHub releases for the core SDK and all mirrored kit repos." \
--reviewer mParticle/sdk-team