-
-
Notifications
You must be signed in to change notification settings - Fork 3
147 lines (120 loc) · 5.29 KB
/
release.yml
File metadata and controls
147 lines (120 loc) · 5.29 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
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: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GH_PAT }}
submodules: recursive
- 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: Set up Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Build BugSplat XCFramework
run: |
# Build the xcframework (PLCrashReporter is statically linked from Vendor/)
./makeXCFramework.sh
# Create zip archive
cd xcframeworks
zip -y -r BugSplat.xcframework.zip BugSplat.xcframework
# Extract macOS dylib for game engine integration (e.g., Unity)
cp BugSplat.xcframework/macos-arm64_x86_64/BugSplat.framework/Versions/A/BugSplat BugSplat-macOS.dylib
install_name_tool -id "@rpath/BugSplat-macOS.dylib" BugSplat-macOS.dylib
- name: Update Package.swift
run: |
CHECKSUM=$(swift package compute-checksum xcframeworks/BugSplat.xcframework.zip)
URL="https://github.com/BugSplat-Git/bugsplat-apple/releases/download/${{ needs.check-version.outputs.next }}/BugSplat.xcframework.zip"
# Update the URL and checksum in Package.swift
sed -i '' 's|url: "https://github.com/BugSplat-Git/bugsplat-apple/releases/download/[^"]*"|url: "'"$URL"'"|' Package.swift
sed -i '' 's|checksum: "[^"]*"|checksum: "'"$CHECKSUM"'"|' 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
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: |
xcframeworks/BugSplat.xcframework.zip
xcframeworks/BugSplat-macOS.dylib
name: Release ${{ needs.check-version.outputs.next }}
body: |
Release of BugSplat.xcframework version ${{ needs.check-version.outputs.next }}
This release includes:
- BugSplat.xcframework (iOS, macOS, tvOS)
- PLCrashReporter statically linked
## Swift Package Manager
```swift
dependencies: [
.package(url: "https://github.com/BugSplat-Git/bugsplat-apple.git", from: "${{ needs.check-version.outputs.next }}")
]
```
## Manual Integration
Download `BugSplat.xcframework.zip`, unzip, and add to your Xcode project.
## Game Engine Integration (Unity, etc.)
Download `BugSplat-macOS.dylib` for macOS native plugin integration.
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}