-
Notifications
You must be signed in to change notification settings - Fork 19
200 lines (200 loc) · 8.62 KB
/
xcframework.yml
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
---
name: xcframework builder
on:
workflow_dispatch:
pull_request:
push:
tags:
- v*.*.*
branches:
- "main"
permissions:
attestations: write
contents: write
id-token: write
jobs:
iOS-device:
runs-on: macos-latest
steps:
- uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
with:
xcode-version: latest-stable
- uses: actions/checkout@v4
- name: xcodegen
uses: bryce-b/xcodegen-action@patch-1
with:
spec: project.yml
quiet: false
version: '2.41.0'
- name: Build iOS device
run: |
xcodebuild clean archive -scheme ElasticApm_iOS \
-configuration Release \
-destination 'generic/platform=iOS' \
-archivePath ./build/Release-iOS.xcarchive \
-derivedDataPath ./build/derivedDataPath \
SKIP_INSTALL=NO
- name: Save artifact
uses: actions/upload-artifact@v4
with:
name: Release-iOS.xcarchive
path: ./build/Release-iOS.xcarchive
iOS-simulator:
runs-on: macos-latest
steps:
- uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
with:
xcode-version: latest-stable
- uses: actions/checkout@v4
- name: xcodegen
uses: bryce-b/xcodegen-action@patch-1
with:
spec: project.yml
quiet: false
version: '2.41.0'
- name: Build iOS simulator
run: |
xcodebuild clean archive -scheme ElasticApm_iOS \
-configuration Release \
-destination 'generic/platform=iOS Simulator' \
-archivePath ./build/Release-iphonesimulator.xcarchive \
-derivedDataPath ./build/derivedDataPath \
SKIP_INSTALL=NO
- name: Save artifact
uses: actions/upload-artifact@v4
with:
name: Release-iphonesimulator.xcarchive
path: ./build/Release-iphonesimulator.xcarchive
iOS-xcframework:
runs-on: macos-latest
needs: [iOS-simulator, iOS-device]
steps:
- uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
with:
xcode-version: latest-stable
- uses: actions/checkout@v4
- name: xcodegen
uses: bryce-b/xcodegen-action@patch-1
with:
spec: project.yml
quiet: false
version: '2.41.0'
- name: Download device builds
uses: actions/download-artifact@v4
with:
pattern: Release-*.xcarchive
path: build
- name: Build iOS xcframework
run: |
ls build
xcodebuild -create-xcframework \
-framework ${{ github.workspace }}/build/Release-iOS.xcarchive/Products/Library/Frameworks/ElasticApm.framework \
-framework ${{ github.workspace }}/build/Release-iphonesimulator.xcarchive/Products/Library/Frameworks/ElasticApm.framework \
-output ${{ github.workspace }}/package/ElasticApm_iOS.xcframework
- name: Upload xcframework
uses: actions/upload-artifact@v4
with:
name: ElasticApm_iOS.xcframework
path: ${{ github.workspace }}/package
macOS:
runs-on: macos-latest
steps:
- uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
with:
xcode-version: latest-stable
- uses: actions/checkout@v4
- name: xcodegen
uses: bryce-b/xcodegen-action@patch-1
with:
spec: project.yml
quiet: false
version: '2.41.0'
- name: Build macOS xcframework
run: |
xcodebuild clean archive -scheme ElasticApm_macOS \
-configuration Release \
-destination 'generic/platform=macOS' \
-archivePath ./build/Release-macOS.xcarchive \
-derivedDataPath ./build/derivedDataPath \
SKIP_INSTALL=NO
xcodebuild -create-xcframework \
-framework $(pwd)/build/Release-macOS.xcarchive/Products/Library/Frameworks/ElasticApm.framework \
-output ./package/ElasticApm_macOS.xcframework
- name: Upload xcframework
uses: actions/upload-artifact@v4
with:
name: ElasticApm_macOS.xcframework
path: ${{ github.workspace }}/package
tvOS:
runs-on: macos-latest
steps:
- uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
with:
xcode-version: latest-stable
- uses: actions/checkout@v4
- name: xcodegen
uses: bryce-b/xcodegen-action@patch-1
with:
spec: project.yml
quiet: false
version: '2.41.0'
- name: Build tvOS xcframework
run: |
xcodebuild clean archive -scheme ElasticApm_tvOS \
-configuration Release \
-destination 'generic/platform=tvOS' \
-archivePath ./build/Release-tvOS.xcarchive \
-derivedDataPath ./build/derivedDataPath \
SKIP_INSTALL=NO
xcodebuild -create-xcframework \
-framework $(pwd)/build/Release-tvOS.xcarchive/Products/Library/Frameworks/ElasticApm.framework \
-output ./package/ElasticApm_tvOS.xcframework
- name: Upload xcframework
uses: actions/upload-artifact@v4
with:
name: ElasticApm_tvOS.xcframework
path: ${{ github.workspace }}/package
Package:
runs-on: macos-latest
needs: [iOS-xcframework, macOS, tvOS]
steps:
- uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
with:
xcode-version: latest-stable
- uses: actions/checkout@v4
- name: download xcframeworks
uses: actions/download-artifact@v4
with:
pattern: ElasticApm_*.xcframework
path: package
merge-multiple: true
- name: Package frameworks
id: package-frameworks
run: |
APP_VERSION=`sed -n -E "s/public static let elasticSwiftAgentVersion: String = \"(.*)\"/\1/p" Sources/apm-agent-ios/Version.swift | sed -e 's/^[[:space:]]*//'`
echo "APP_VERSION=${APP_VERSION}" >> "$GITHUB_ENV"
rm -rf "./dist"
mkdir -p "./dist"
tar -czf "./dist/ElasticApm_tvOS-${APP_VERSION}.tar.gz" -C ./package ElasticApm_tvOS.xcframework
tar -czf "./dist/ElasticApm_macOS-${APP_VERSION}.tar.gz" -C ./package ElasticApm_macOS.xcframework
tar -czf "./dist/ElasticApm_iOS-${APP_VERSION}.tar.gz" -C ./package ElasticApm_iOS.xcframework
- name: Generate framework provenance
uses: actions/attest-build-provenance@173725a1209d09b31f9d30a3890cf2757ebbff0d # v1.1.2
with:
subject-path: "./dist/*"
- name: Create release (for tag release only)
if: startsWith(github.ref, 'refs/tags')
run: |
readonly LATEST_GIT_TAG=$(git tag --list --sort=version:refname "v*" | grep -v - | tail -n1)
if [[ "$GITHUB_REF_NAME" == "$LATEST_GIT_TAG" ]]; then
IS_LATEST=true
else
IS_LATEST=false
fi
echo "INFO: Create '$GITHUB_REF_NAME' GitHub release (latest=$IS_LATEST)."
gh release create "$GITHUB_REF_NAME" \
--title "$GITHUB_REF_NAME" \
--latest=$IS_LATEST \
./dist/*
env:
GH_TOKEN: ${{ github.token }}