Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,6 @@ iOSInjectionProject/
Package.resolved
*.xcuserdatad
/.swiftpm/xcode/xcshareddata

# XCFramework
Segment-Package_XCFramework
19 changes: 13 additions & 6 deletions Build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@ FRAMEWORK_FOLDER_NAME="${PROJECT_NAME}_XCFramework"
FRAMEWORK_NAME="Segment"

#xcframework path
FRAMEWORK_PATH="${HOME}/Desktop/${FRAMEWORK_FOLDER_NAME}/${FRAMEWORK_NAME}.xcframework"
FRAMEWORK_PATH="${FRAMEWORK_FOLDER_NAME}/${FRAMEWORK_NAME}.xcframework"

# set path for iOS simulator archive
SIMULATOR_ARCHIVE_PATH="${HOME}/Desktop/${FRAMEWORK_FOLDER_NAME}/simulator.xcarchive"
SIMULATOR_ARCHIVE_PATH="${FRAMEWORK_FOLDER_NAME}/simulator.xcarchive"

# set path for iOS device archive
IOS_DEVICE_ARCHIVE_PATH="${HOME}/Desktop/${FRAMEWORK_FOLDER_NAME}/iOS.xcarchive"
IOS_DEVICE_ARCHIVE_PATH="${FRAMEWORK_FOLDER_NAME}/iOS.xcarchive"

rm -rf "${HOME}/Desktop/${FRAMEWORK_FOLDER_NAME}"
# clean up old releases
zip -r Segment.xcframework.zip
echo "Deleted the xcframework"

rm -rf "${FRAMEWORK_FOLDER_NAME}"
echo "Deleted ${FRAMEWORK_FOLDER_NAME}"

mkdir "${HOME}/Desktop/${FRAMEWORK_FOLDER_NAME}"
mkdir "${FRAMEWORK_FOLDER_NAME}"
echo "Created ${FRAMEWORK_FOLDER_NAME}"

echo "Archiving ${FRAMEWORK_NAME}"
Expand All @@ -34,4 +38,7 @@ xcodebuild archive -scheme ${PROJECT_NAME} -destination="iOS" -archivePath "${IO
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}"
rm -rf "${SIMULATOR_ARCHIVE_PATH}"
rm -rf "${IOS_DEVICE_ARCHIVE_PATH}"
open "${HOME}/Desktop/${FRAMEWORK_FOLDER_NAME}"

zip -r Segment.xcframework.zip "${FRAMEWORK_FOLDER_NAME}/Segment.xcframework"

open "${FRAMEWORK_FOLDER_NAME}"
4 changes: 2 additions & 2 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Releasing
=========

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

ex: $ ./release.sh 1.1.1

12 changes: 8 additions & 4 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fi

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

# no args, so give usage.
if [ $# -eq 0 ]
if [ $# -eq 0 ]
then
echo "Release automation script"
echo ""
Expand All @@ -87,15 +87,15 @@ case $? in
2) op='<';;
esac

if [ $op != '>' ]
if [ $op != '>' ]
then
echo "New version must be greater than previous version ($version)."
exit 1
fi

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

# build up the xcframework to upload to github
./build.sh

# upload the release
gh release upload $version Segment.xcframework.zip