forked from niochat/MatrixSDK
-
Notifications
You must be signed in to change notification settings - Fork 1
171 lines (145 loc) · 6.06 KB
/
build-peeree.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
name: Build and Release
on: push
env:
# change this variable to a release of https://github.com/matrix-org/matrix-ios-sdk/releases
RELEASE_VERSION: v0.24.2
jobs:
build:
strategy:
matrix:
platform: [ios, simulator]
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Checkout matrix-ios-sdk
uses: actions/checkout@v3
with:
repository: Topheee/matrix-ios-sdk
ref: peeree-compat-${{ env.RELEASE_VERSION }}
path: matrix-ios-sdk
- name: Cache CocoaPods
id: cache-cocoapods
uses: actions/cache@v3
with:
# CocoaPods
path: Pods
key: cocoapods-deps-${{ hashFiles('**/Podfile.lock') }}
- if: ${{ steps.cache-cocoapods.outputs.cache-hit != 'true' }}
name: Install Pods
working-directory: matrix-ios-sdk
run: pod install
- name: "Build ${{ matrix.platform }}"
working-directory: matrix-ios-sdk
run: |
case "${{ matrix.platform }}" in
ios)
destination="generic/platform=iOS"
flags='IPHONEOS_DEPLOYMENT_TARGET=13.0'
archive_path_suffix=iOS
;;
simulator)
destination="generic/platform=iOS Simulator"
flags='IPHONEOS_DEPLOYMENT_TARGET=13.0'
archive_path_suffix=iOSSimulator
;;
macos)
destination="generic/platform=macOS"
flags='MACOSX_DEPLOYMENT_TARGET=10.12'
archive_path_suffix=macOS
;;
catalyst)
destination="generic/platform=macOS,variant=Mac Catalyst"
flags='IPHONEOS_DEPLOYMENT_TARGET=13.0'
archive_path_suffix=MacCatalyst
;;
esac
xcodebuild archive -workspace MatrixSDK.xcworkspace -scheme MatrixSDK-iOS -destination "$destination" -archivePath "build/MatrixSDK-$archive_path_suffix" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS=NO $flags
- name: Set Bundle Version
working-directory: matrix-ios-sdk/build
run: |
case ${{ matrix.platform }} in ios) archive_end=iOS ;; simulator) archive_end=iOSSimulator ;; macos) archive_end=macOS ;; catalyst) archive_end=MacCatalyst ;; esac
VERSION=${{ env.RELEASE_VERSION }}
SHORT_VERSION=${VERSION#v}
plutil -insert CFBundleShortVersionString -string $SHORT_VERSION "MatrixSDK-${archive_end}.xcarchive/Products/Library/Frameworks/MatrixSDK.framework/Info.plist"
plutil -insert CFBundleVersion -string $GITHUB_RUN_NUMBER "MatrixSDK-${archive_end}.xcarchive/Products/Library/Frameworks/MatrixSDK.framework/Info.plist"
- name: "Save ${{ matrix.platform }} Framework"
uses: actions/upload-artifact@v3
with:
name: "${{ matrix.platform }} Framework"
path: matrix-ios-sdk/build/*.xcarchive
link:
# Compile platform-specific frameworks into a fat framework.
name: Produce Framework
needs: build
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Download iOS Framework
uses: actions/download-artifact@v3
with:
name: ios Framework
- name: Download iOS Simulator Framework
uses: actions/download-artifact@v3
with:
name: simulator Framework
- name: Make XCFramework
run: |
iOSBCMaps=()
echo "Finding iOS Bitcode Symbol Maps"
while IFS= read -d '' -r filename; do
iOSBCMaps+=("$filename")
done < <(find "$(pwd -P)"/MatrixSDK-iOS.xcarchive -name "*.bcsymbolmap" -print0)
set +u
iOSBCMapCount=${#iOSBCMaps[@]}
set -u
iOSDebugSymbols=""
echo "Generating iOS Bitcode Symbol Map command"
for ((i=0;i<iOSBCMapCount;i++)); do
iOSDebugSymbols+=" -debug-symbols ${iOSBCMaps[i]}"
done
echo "Creating XCFramework"
xcodebuild -create-xcframework -framework MatrixSDK-iOS.xcarchive/Products/Library/Frameworks/MatrixSDK.framework -debug-symbols "$(pwd -P)/MatrixSDK-iOS.xcarchive/dSYMs/MatrixSDK.framework.dSYM" $iOSDebugSymbols -framework MatrixSDK-iOSSimulator.xcarchive/Products/Library/Frameworks/MatrixSDK.framework -debug-symbols "$(pwd -P)/MatrixSDK-iOSSimulator.xcarchive/dSYMs/MatrixSDK.framework.dSYM" -output MatrixSDK.xcframework
zip -ry MatrixSDK.xcframework.zip MatrixSDK.xcframework
- name: Update Package Manifest
run: |
swift package compute-checksum MatrixSDK.xcframework.zip > checksum
CHECKSUM=$(cat checksum)
cat checksum
swift generate-package.swift "https://github.com/${{ github.repository_owner }}/MatrixSDK/releases/download/${{ env.RELEASE_VERSION }}/MatrixSDK.xcframework.zip" "$CHECKSUM"
- name: Push and Tag
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add Package.swift
git commit -m "Release ${{ env.RELEASE_VERSION }}"
git push
git tag ${{ env.RELEASE_VERSION }}
git push origin ${{ env.RELEASE_VERSION }}
- name: Create Release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RELEASE_VERSION }}
release_name: ${{ env.RELEASE_VERSION }}
draft: false
prerelease: false
- name: Upload XCFramework
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: MatrixSDK.xcframework.zip
asset_name: MatrixSDK.xcframework.zip
asset_content_type: application/zip
- name: Upload Checksum
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: checksum
asset_name: MatrixSDK.xcframework.zip.checksum
asset_content_type: text/plain