Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
208 changes: 208 additions & 0 deletions .github/workflows/release-ecosystem-from-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
name: Publish Ecosystem Releases from Main
# Build each kit, mirror its subtree repo, and publish a GitHub release/tag (unless dry run).

on:
push:
branches:
- main
- workstation*
paths:
- VERSION
workflow_dispatch:
inputs:
dry_run:
description: "Dry run — skip creating real releases/tags"
type: boolean
default: true

env:
DRY_RUN: ${{ github.event.inputs.dry_run || 'true' }}

permissions:
contents: write

jobs:
build-kits:
name: Build ${{ matrix.kit.name }}
runs-on: macOS-latest
env:
XCODE_VERSION: "16.4"
strategy:
fail-fast: false
matrix:
kit:
- name: braze-12
local_path: kits/braze/braze-12
dest_repo: mparticle-apple-integration-braze-12
ios_scheme: mParticle-Braze
tvos_scheme: mParticle-Braze-tvOS
module: mParticle_Braze
# - name: braze-13
# local_path: kits/braze/braze-13
# dest_repo: mparticle-apple-integration-braze-13
# ios_scheme: mParticle-Braze
# tvos_scheme: mParticle-Braze-tvOS
# module: mParticle_Braze
# - name: braze-14
# local_path: kits/braze/braze-14
# dest_repo: mparticle-apple-integration-braze-14
# ios_scheme: mParticle-Braze
# tvos_scheme: mParticle-Braze-tvOS
# module: mParticle_Braze

steps:
- name: Checkout monorepo
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Select Xcode
run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app

- name: Build kit xcframework
run: |
PROJECT="$(ls -d ${{ matrix.kit.local_path }}/*.xcodeproj | head -1)"
MODULE="${{ matrix.kit.module }}"
IOS_SCHEME="${{ matrix.kit.ios_scheme }}"
TVOS_SCHEME="${{ matrix.kit.tvos_scheme }}"

BUILD_SETTINGS="CODE_SIGN_IDENTITY= CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES"

xcodebuild archive -project "$PROJECT" -scheme "$IOS_SCHEME" \
-destination "generic/platform=iOS" -archivePath "archives/iOS" $BUILD_SETTINGS
xcodebuild archive -project "$PROJECT" -scheme "$IOS_SCHEME" \
-destination "generic/platform=iOS Simulator" -archivePath "archives/iOS_Simulator" $BUILD_SETTINGS

XCFRAMEWORK_ARGS="-archive archives/iOS.xcarchive -framework ${MODULE}.framework"
XCFRAMEWORK_ARGS+=" -archive archives/iOS_Simulator.xcarchive -framework ${MODULE}.framework"

if [ -n "$TVOS_SCHEME" ]; then
xcodebuild archive -project "$PROJECT" -scheme "$TVOS_SCHEME" \
-destination "generic/platform=tvOS" -archivePath "archives/tvOS" $BUILD_SETTINGS
xcodebuild archive -project "$PROJECT" -scheme "$TVOS_SCHEME" \
-destination "generic/platform=tvOS Simulator" -archivePath "archives/tvOS_Simulator" $BUILD_SETTINGS

XCFRAMEWORK_ARGS+=" -archive archives/tvOS.xcarchive -framework ${MODULE}.framework"
XCFRAMEWORK_ARGS+=" -archive archives/tvOS_Simulator.xcarchive -framework ${MODULE}.framework"
fi

xcodebuild -create-xcframework $XCFRAMEWORK_ARGS -output "${MODULE}.xcframework"

zip -r "${MODULE}.xcframework.zip" "${MODULE}.xcframework"
rm -rf archives "${MODULE}.xcframework"

- name: Upload xcframework artifact
uses: actions/upload-artifact@v4
with:
name: xcframework-${{ matrix.kit.name }}
path: ${{ matrix.kit.module }}.xcframework.zip

mirror-and-release-kits:
name: Mirror & Release ${{ matrix.kit.name }}
runs-on: macOS-latest
needs: build-kits
env:
DEST_ORG: mparticle-integrations
strategy:
fail-fast: false
matrix:
kit:
- name: braze-12
local_path: kits/braze/braze-12
dest_repo: mparticle-apple-integration-braze-12
module: mParticle_Braze
# - name: braze-13
# local_path: kits/braze/braze-13
# dest_repo: mparticle-apple-integration-braze-13
# module: mParticle_Braze
# - name: braze-14
# local_path: kits/braze/braze-14
# dest_repo: mparticle-apple-integration-braze-14
# module: mParticle_Braze

steps:
- name: Checkout monorepo
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Download xcframework artifact
uses: actions/download-artifact@v4
with:
name: xcframework-${{ matrix.kit.name }}

- name: Get ecosystem version
id: version
run: |
VERSION=$(head -n 1 VERSION | tr -d '\r\n ')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
echo "📌 Ecosystem version: $VERSION"

- name: Generate GitHub App Token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.SDK_RELEASE_GITHUB_APP_ID }}
private-key: ${{ secrets.SDK_RELEASE_GITHUB_APP_PRIVATE_KEY }}
owner: ${{ env.DEST_ORG }}
repositories: ${{ matrix.kit.dest_repo }}
permission-contents: write

- name: Extract kit release notes
id: release-notes
uses: ffurrer2/extract-release-notes@202313ec7461b6b9e401996714484690ab1ae105 # v3.0.0
with:
changelog_file: ${{ matrix.kit.local_path }}/CHANGELOG.md
prerelease: true

- name: Split kit and push to mirror
id: mirror
run: |
SPLIT_BRANCH="split/${{ matrix.kit.name }}"
git subtree split --prefix ${{ matrix.kit.local_path }} -b "${SPLIT_BRANCH}"

- name: Push split to destination
if: env.DRY_RUN != 'true'
id: push
run: |
DEST_URL="https://x-access-token:${{ steps.generate-token.outputs.token }}@github.com/${{ env.DEST_ORG }}/${{ matrix.kit.dest_repo }}.git"
git push "$DEST_URL" "split/${{ matrix.kit.name }}:main" --force
echo "sha=$(git rev-parse split/${{ matrix.kit.name }})" >> $GITHUB_OUTPUT

- name: Create GitHub release on mirror
if: env.DRY_RUN != 'true'
uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b # v1.20.0
with:
tag: ${{ steps.version.outputs.tag }}
commit: ${{ steps.push.outputs.sha }}
owner: ${{ env.DEST_ORG }}
repo: ${{ matrix.kit.dest_repo }}
token: ${{ steps.generate-token.outputs.token }}
artifacts: xcframework-${{ matrix.kit.name }}/${{ matrix.kit.module }}.xcframework.zip
body: |
${{ steps.release-notes.outputs.release_notes }}

- name: Summary
run: |
COMMITS=$(git log "split/${{ matrix.kit.name }}" --oneline -5)
cat >> $GITHUB_STEP_SUMMARY <<EOF
## Kit Mirror: ${{ matrix.kit.name }}

| Property | Value |
|----------|-------|
| **Kit** | \`${{ matrix.kit.name }}\` |
| **Source** | \`${{ matrix.kit.local_path }}\` |
| **Destination** | \`${{ env.DEST_ORG }}/${{ matrix.kit.dest_repo }}\` |
| **Tag** | \`${{ steps.version.outputs.tag }}\` |
| **Dry Run** | \`${{ env.DRY_RUN }}\` |
| **Artifact** | \`${{ matrix.kit.module }}.xcframework.zip\` |

### Split branch commits
\`\`\`
${COMMITS}
\`\`\`

### Release notes
${{ steps.release-notes.outputs.release_notes }}
EOF
147 changes: 147 additions & 0 deletions .github/workflows/sdk-release-ecosystem-manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
name: Create Ecosystem Release PR (Manual)
# 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: |
find . -name "*.podspec" -exec \
sed -i '' 's/\(s\.version[^=]*=[[:space:]]*\)"[^"]*"/\1"'"${VERSION}"'"/' {} +

- name: Update version in MPIConstants.m
run: sed -i '' "s/kMParticleSDKVersion = @\"[^\"]*\"/kMParticleSDKVersion = @\"${VERSION}\"/" mParticle-Apple-SDK/MPIConstants.m

- name: Update version in MPConstants.swift
run: sed -i '' "s/let kMParticleSDKVersion = \"[^\"]*\"/let kMParticleSDKVersion = \"${VERSION}\"/" mParticle-Apple-SDK/MPConstants.swift

- name: Update version in Info.plist
run: /usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${VERSION}" Framework/Info.plist

- name: Update SDK version in integration test mappings
run: ./Scripts/update_mapping_versions.sh "${VERSION}"

- name: Update kit dependency on core SDK for major release
if: github.event.inputs.bump-type == 'major'
run: |
# Podspec: '~> X.Y' → '~> MAJOR.0'
find kits -name "*.podspec" -exec \
sed -i '' "s/'mParticle-Apple-SDK', '~> [^']*'/'mParticle-Apple-SDK', '~> ${MAJOR}.0'/" {} +

# Package.swift: .upToNextMajor(from: "X.Y.Z") → .upToNextMajor(from: "MAJOR.0.0")
find kits -name "Package.swift" -exec \
sed -i '' "/mparticle-apple-sdk/{
n
s/.upToNextMajor(from: \"[^\"]*\")/.upToNextMajor(from: \"${MAJOR}.0.0\")/
s/branch: \"[^\"]*\"/.upToNextMajor(from: \"${MAJOR}.0.0\")/
}" {} +

# --- Commit, push, and create PR ---

- name: Commit version changes
run: |
git add \
VERSION \
Framework/Info.plist \
mParticle-Apple-SDK.podspec \
mParticle-Apple-SDK-Swift/mParticle-Apple-SDK-Swift.podspec \
mParticle-Apple-SDK/MPConstants.swift \
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\`
- \`mParticle-Apple-SDK/MPConstants.swift\`
- \`Framework/Info.plist\`
- Integration test mappings

---

**On merge:** The [Publish Ecosystem Releases from Main](https://github.com/mParticle/mparticle-apple-sdk/actions/workflows/release-ecosystem-from-main.yml) workflow will automatically create tags and GitHub releases for the core SDK and all mirrored kit repos." \
--reviewer mParticle/sdk-team
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.43.1
Loading
Loading