Skip to content

Commit 2dd92f9

Browse files
author
Sebastian Fichtner
committed
Add simple CI scripts
1 parent c671851 commit 2dd92f9

File tree

4 files changed

+119
-1
lines changed

4 files changed

+119
-1
lines changed

Diff for: .gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
swiftpm/
22
*xcuserdata/
3-
Package.resolved
3+
Package.resolved
4+
CI/Upload/Byproducts/

Diff for: CI/Upload/ExportOptions.plist

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>generateAppStoreInformation</key>
6+
<false/>
7+
<key>installerSigningCertificate</key>
8+
<string>3rd Party Mac Developer Installer: Sebastian Fichtner (8T3R57GCBV)</string>
9+
<key>manageAppVersionAndBuildNumber</key>
10+
<false/>
11+
<key>method</key>
12+
<string>app-store</string>
13+
<key>provisioningProfiles</key>
14+
<dict>
15+
<key>com.flowtoolz.codeface</key>
16+
<string>Codeface macOS Distribution Profile</string>
17+
</dict>
18+
<key>signingCertificate</key>
19+
<string>Apple Distribution</string>
20+
<key>signingStyle</key>
21+
<string>manual</string>
22+
<key>uploadSymbols</key>
23+
<true/>
24+
</dict>
25+
</plist>

Diff for: CI/Upload/upload.sh

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/bin/zsh
2+
3+
# Specify inputs
4+
5+
PROJECT="XcodeProject/Codeface.xcodeproj"
6+
SCHEME="Codeface"
7+
UPLOAD_DIRECTORY="CI/Upload"
8+
EXPORT_OPTIONS_PLIST="$UPLOAD_DIRECTORY/ExportOptions.plist"
9+
10+
# Specify byproducts
11+
12+
ARCHIVE="$UPLOAD_DIRECTORY/Byproducts/Codeface.xcarchive"
13+
PACKAGE="$UPLOAD_DIRECTORY/Byproducts/Codeface.pkg"
14+
15+
# set "exit immediately" (this script terminates when any command returns non-zero)
16+
17+
set -e
18+
19+
# Read credentials from arguments
20+
21+
if [ $# -ne 2 ] # if the number of arguments is not equal 2
22+
then
23+
echo "Usage: $0 <username> <password>"
24+
exit 1
25+
fi
26+
27+
APP_STORE_USER="$1"
28+
APP_STORE_PASSWORD="$2"
29+
30+
# Declare a function for each step
31+
32+
function archiveTheProject {
33+
echo "🤖 Archiving $PROJECT to $ARCHIVE ..."
34+
rm -R $ARCHIVE
35+
xcodebuild archive \
36+
-project $PROJECT \
37+
-archivePath $ARCHIVE \
38+
-scheme $SCHEME \
39+
-sdk macosx \
40+
-destination 'platform=macOS,arch=arm64' \
41+
-destination 'platform=macOS,arch=x86_64' \
42+
-configuration Release \
43+
> /dev/null
44+
}
45+
46+
function exportTheArchive {
47+
echo "🤖 Exporting $ARCHIVE to $PACKAGE ..."
48+
rm -R $PACKAGE
49+
xcodebuild -exportArchive \
50+
-archivePath $ARCHIVE \
51+
-exportPath $PACKAGE \
52+
-exportOptionsPlist $EXPORT_OPTIONS_PLIST \
53+
> /dev/null
54+
}
55+
56+
function uploadTheExport {
57+
echo "🤖 Uploading $PACKAGE to App Store Connect ..."
58+
xcrun altool --upload-app \
59+
--type macos \
60+
--file "$PACKAGE" \
61+
--username "$APP_STORE_USER" \
62+
--password "$APP_STORE_PASSWORD" \
63+
> /dev/null
64+
echo "🤖 Did upload $PACKAGE to App Store Connect ✅"
65+
}
66+
67+
# Run each step
68+
69+
archiveTheProject
70+
exportTheArchive
71+
uploadTheExport

Diff for: CI/test.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/zsh
2+
3+
# Specify inputs
4+
5+
PROJECT="XcodeProject/Codeface.xcodeproj"
6+
SCHEME="Codeface"
7+
8+
# Declare and run test function
9+
10+
function testTheProject {
11+
echo "🤖 Testing $PROJECT ..."
12+
xcodebuild clean build test \
13+
-project $PROJECT \
14+
-scheme $SCHEME \
15+
-sdk macosx \
16+
-destination 'platform=macOS,arch=arm64' \
17+
-configuration Debug \
18+
> /dev/null
19+
}
20+
21+
testTheProject

0 commit comments

Comments
 (0)