chore: release v1.2.1 #25
This file contains 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: Build and Release XCFramework | |
on: | |
push: | |
branches: | |
- main | |
# Add permissions block to allow writing | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
check-version: | |
runs-on: ubuntu-latest | |
outputs: | |
current: ${{ steps.semver.outputs.current }} | |
next: ${{ steps.semver.outputs.next }} | |
should_build: ${{ steps.check.outputs.should_build }} | |
steps: | |
- name: Get Next Version | |
id: semver | |
uses: ietf-tools/semver-action@v1 | |
with: | |
token: ${{ secrets.GH_PAT }} | |
branch: main | |
noVersionBumpBehavior: silent | |
- name: Check Version Bump | |
id: check | |
run: | | |
if [ -z "${{ steps.semver.outputs.next }}" ] || [ "${{ steps.semver.outputs.next }}" = "${{ steps.semver.outputs.current }}" ]; then | |
echo "No version bump needed. Current version: ${{ steps.semver.outputs.current }}" | |
echo "should_build=false" >> $GITHUB_OUTPUT | |
else | |
echo "Version bump needed from ${{ steps.semver.outputs.current }} to ${{ steps.semver.outputs.next }}" | |
echo "should_build=true" >> $GITHUB_OUTPUT | |
fi | |
build-and-release: | |
needs: check-version | |
if: needs.check-version.outputs.should_build == 'true' | |
runs-on: macos-latest | |
steps: | |
- name: Create parent directory | |
run: | | |
mkdir bugsplat-workspace | |
cd bugsplat-workspace | |
- name: Install the Apple certificate | |
env: | |
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} | |
P12_PASSWORD: ${{ secrets.P12_PASSWORD }} | |
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | |
run: | | |
# create variables | |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 | |
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db | |
# import certificate from secrets | |
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH | |
# create temporary keychain | |
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH | |
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
# import certificate to keychain | |
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | |
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
security list-keychain -d user -s $KEYCHAIN_PATH | |
- name: Clone repositories | |
working-directory: bugsplat-workspace | |
run: | | |
# Clone bugsplat-apple with token for push access | |
git clone https://${{ secrets.GH_PAT }}@github.com/BugSplat-Git/bugsplat-apple.git | |
git clone /~https://github.com/BugSplat-Git/HockeySDK-Mac | |
git clone /~https://github.com/BugSplat-Git/HockeySDK-iOS | |
git clone /~https://github.com/BugSplat-Git/plCrashReporter | |
- name: Set up Xcode 15.4 | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: '15.4' | |
- name: Build PlCrashReporter | |
working-directory: bugsplat-workspace/plCrashReporter | |
run: | | |
./makeXCFramework.sh | |
- name: Build HockeySDK-Mac | |
working-directory: bugsplat-workspace/HockeySDK-Mac | |
run: | | |
./makeXCFramework.sh | |
- name: Build HockeySDK-iOS | |
working-directory: bugsplat-workspace/HockeySDK-iOS | |
run: | | |
./makeXCFramework.sh | |
- name: Build BugSplat | |
working-directory: bugsplat-workspace/bugsplat-apple | |
run: | | |
./makeXCFramework.sh | |
# Create zip archive of the framework | |
cd xcframeworks | |
zip -y -r BugSplat.xcframework.zip BugSplat.xcframework | |
- name: Update Package.swift | |
working-directory: bugsplat-workspace/bugsplat-apple | |
run: | | |
# Calculate checksum | |
CHECKSUM=$(swift package compute-checksum xcframeworks/BugSplat.xcframework.zip) | |
# Create a temporary file with the new content | |
sed "s|url: \".*\"|url: \"/~https://github.com/BugSplat-Git/bugsplat-apple/releases/download/${{ needs.check-version.outputs.next }}/BugSplat.xcframework.zip\"|" Package.swift > Package.swift.tmp | |
sed "s|checksum: \".*\"|checksum: \"${CHECKSUM}\"|" Package.swift.tmp > Package.swift | |
rm Package.swift.tmp | |
# Commit and push the updated Package.swift | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
git add Package.swift | |
git commit -m "chore: release ${{ needs.check-version.outputs.next }}" | |
git push origin HEAD:main | |
- name: Create and Push Tag | |
working-directory: bugsplat-workspace/bugsplat-apple | |
run: | | |
git tag ${{ needs.check-version.outputs.next }} | |
git push origin ${{ needs.check-version.outputs.next }} | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ needs.check-version.outputs.next }} | |
files: bugsplat-workspace/bugsplat-apple/xcframeworks/BugSplat.xcframework.zip | |
name: Release ${{ needs.check-version.outputs.next }} | |
body: | | |
Release of BugSplat.xcframework version ${{ needs.check-version.outputs.next }} | |
This release contains: | |
- iOS framework | |
- iOS Simulator framework | |
- macOS framework | |
Swift Package Manager: | |
```swift | |
dependencies: [ | |
.package(url: "/~https://github.com/BugSplat-Git/bugsplat-apple.git", from: "${{ needs.check-version.outputs.next }}") | |
] | |
``` | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_PAT }} |