Skip to content

Commit d63f39a

Browse files
authored
Added ability to add xcframework as an artifact (#140)
Added ability to add a xcframework as an artifact during release
1 parent d0a1097 commit d63f39a

File tree

4 files changed

+27
-12
lines changed

4 files changed

+27
-12
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,7 @@ iOSInjectionProject/
9292
Package.resolved
9393
*.xcuserdatad
9494
/.swiftpm/xcode/xcshareddata
95+
96+
# XCFramework
97+
Segment-Package_XCFramework
98+
*.zip

RELEASING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ Releasing
22
=========
33

44
Use `release.sh` to perform releases. This script will perform all the safety checks as well
5-
as update Version.swfit, commit the change, and create tag + release. History since the last
5+
as update Version.swift, commit the change, and create tag + release. History since the last
66
released version will be used as the changelog for the release.
77

88
ex: $ ./release.sh 1.1.1
9-
9+

Build.sh renamed to build.sh

+13-6
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,22 @@ FRAMEWORK_FOLDER_NAME="${PROJECT_NAME}_XCFramework"
1010
FRAMEWORK_NAME="Segment"
1111

1212
#xcframework path
13-
FRAMEWORK_PATH="${HOME}/Desktop/${FRAMEWORK_FOLDER_NAME}/${FRAMEWORK_NAME}.xcframework"
13+
FRAMEWORK_PATH="${FRAMEWORK_FOLDER_NAME}/${FRAMEWORK_NAME}.xcframework"
1414

1515
# set path for iOS simulator archive
16-
SIMULATOR_ARCHIVE_PATH="${HOME}/Desktop/${FRAMEWORK_FOLDER_NAME}/simulator.xcarchive"
16+
SIMULATOR_ARCHIVE_PATH="${FRAMEWORK_FOLDER_NAME}/simulator.xcarchive"
1717

1818
# set path for iOS device archive
19-
IOS_DEVICE_ARCHIVE_PATH="${HOME}/Desktop/${FRAMEWORK_FOLDER_NAME}/iOS.xcarchive"
19+
IOS_DEVICE_ARCHIVE_PATH="${FRAMEWORK_FOLDER_NAME}/iOS.xcarchive"
2020

21-
rm -rf "${HOME}/Desktop/${FRAMEWORK_FOLDER_NAME}"
21+
# clean up old releases
22+
zip -r Segment.xcframework.zip
23+
echo "Deleted the xcframework"
24+
25+
rm -rf "${FRAMEWORK_FOLDER_NAME}"
2226
echo "Deleted ${FRAMEWORK_FOLDER_NAME}"
2327

24-
mkdir "${HOME}/Desktop/${FRAMEWORK_FOLDER_NAME}"
28+
mkdir "${FRAMEWORK_FOLDER_NAME}"
2529
echo "Created ${FRAMEWORK_FOLDER_NAME}"
2630

2731
echo "Archiving ${FRAMEWORK_NAME}"
@@ -34,4 +38,7 @@ xcodebuild archive -scheme ${PROJECT_NAME} -destination="iOS" -archivePath "${IO
3438
xcodebuild -create-xcframework -framework ${SIMULATOR_ARCHIVE_PATH}/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework -framework ${IOS_DEVICE_ARCHIVE_PATH}/Products/Library/Frameworks/${FRAMEWORK_NAME}.framework -output "${FRAMEWORK_PATH}"
3539
rm -rf "${SIMULATOR_ARCHIVE_PATH}"
3640
rm -rf "${IOS_DEVICE_ARCHIVE_PATH}"
37-
open "${HOME}/Desktop/${FRAMEWORK_FOLDER_NAME}"
41+
42+
zip -r Segment.xcframework.zip "${FRAMEWORK_FOLDER_NAME}/Segment.xcframework"
43+
44+
open "${FRAMEWORK_FOLDER_NAME}"

release.sh

+8-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ fi
4949

5050
# check that we're on the `main` branch
5151
branch=$(git rev-parse --abbrev-ref HEAD)
52-
if [ $branch != 'main' ]
52+
if [ $branch != 'main' ]
5353
then
5454
echo "The 'main' must be the current branch to make a release."
5555
echo "You are currently on: $branch"
@@ -68,7 +68,7 @@ version=$(sed "s/[' \"]//g" <<< "$version")
6868
echo "Analytics-Swift current version: $version"
6969

7070
# no args, so give usage.
71-
if [ $# -eq 0 ]
71+
if [ $# -eq 0 ]
7272
then
7373
echo "Release automation script"
7474
echo ""
@@ -87,15 +87,15 @@ case $? in
8787
2) op='<';;
8888
esac
8989

90-
if [ $op != '>' ]
90+
if [ $op != '>' ]
9191
then
9292
echo "New version must be greater than previous version ($version)."
9393
exit 1
9494
fi
9595

9696
read -r -p "Are you sure you want to release $newVersion? [y/N] " response
9797
case "$response" in
98-
[yY][eE][sS]|[yY])
98+
[yY][eE][sS]|[yY])
9999
;;
100100
*)
101101
exit 1
@@ -123,4 +123,8 @@ gh release create $newVersion -F $tempFile -t "Version $newVersion"
123123
# remove the tempfile.
124124
rm $tempFile
125125

126+
# build up the xcframework to upload to github
127+
./build.sh
126128

129+
# upload the release
130+
gh release upload $version Segment.xcframework.zip

0 commit comments

Comments
 (0)