-
-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #147 from fermoya/feat/extract-ci-scripts
Extracting scripts and updating ci flows
- Loading branch information
Showing
8 changed files
with
109 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,4 @@ jobs: | |
DEFAULT_BUMP: none | ||
WITH_V: false | ||
PRERELEASE_SUFFIX: beta | ||
VERBOSE: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,9 +18,14 @@ jobs: | |
- uses: actions/checkout@v2 | ||
|
||
- name: Create XCFramework | ||
uses: fermoya/[email protected] | ||
id: xcframework | ||
run: ./scripts/build_xcframework.sh | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
platforms: ios, macos, maccatalyst, tvos, watchos | ||
name: SwiftUIPager.xcframework.zip | ||
path: ${{ steps.xcframework.outputs.path }} | ||
|
||
create_release: | ||
name: Create Release and Upload artfifacts | ||
|
@@ -34,11 +39,7 @@ jobs: | |
run: | | ||
name=VERSION::${GITHUB_REF/refs\/tags\//} | ||
echo "Tag: $name" | ||
if [[ "$name" == *"beta"* ]]; then | ||
prerelease=true | ||
else | ||
prerelease=false | ||
fi | ||
if [[ "$name" == *"beta"* ]]; then prerelease=true; else prerelease=false; fi | ||
echo ::set-output name=prerelease::$prerelease | ||
- name: Create Release | ||
|
@@ -57,10 +58,8 @@ jobs: | |
- name: Download artifact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: SwiftUIPager.zip | ||
name: SwiftUIPager.xcframework.zip | ||
path: ./ | ||
|
||
- run: mv SwiftUIPager.zip SwiftUIPager.xcframework.zip | ||
|
||
- name: Upload Release Asset | ||
id: upload-release-asset | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
name: Rebase branch legacy-projects | ||
|
||
on: | ||
# Trigger the workflow on push pull request or manually | ||
push: | ||
branches: [ develop ] | ||
|
||
|
@@ -22,29 +21,4 @@ jobs: | |
USER_EMAIL: [email protected] | ||
OUTDATED_BRANCH: legacy-projects | ||
BASE_BRANCH: develop | ||
run: | | ||
FOLDER=$(echo $GITHUB_REPOSITORY | cut -d'/' -f2) | ||
git clone https://x-access-token:[email protected]/$GITHUB_REPOSITORY.git | ||
cd $FOLDER | ||
git checkout $OUTDATED_BRANCH | ||
echo Adding origin as $GITHUB_REPOSITORY | ||
git remote set-url origin https://x-access-token:[email protected]/$GITHUB_REPOSITORY.git | ||
git config --global user.email "$USER_EMAIL" | ||
git config --global user.name "$USER_NAME" | ||
git fetch origin $BASE_BRANCH | ||
echo git pull --rebase origin $OUTDATED_BRANCH | ||
git pull --rebase origin $OUTDATED_BRANCH | ||
echo Rebasing $BASE_BRANCH onto $OUTDATED_BRANCH | ||
echo git rebase origin/$BASE_BRANCH | ||
git rebase origin/$BASE_BRANCH | ||
echo git push --force-with-lease origin $OUTDATED_BRANCH | ||
git push --force-with-lease origin $OUTDATED_BRANCH | ||
cd .. | ||
rm -rf $FOLDER | ||
run: ./scripts/rebase.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
gem install xcpretty | ||
|
||
SCHEMES=( SwiftUIPager_Catalyst SwiftUIPager_macOS SwiftUIPager_iOS SwiftUIPager_watchOS SwiftUIPager_tvOS ) | ||
PLATFORMS=( "platform=macOS,variant=Mac Catalyst" "platform=macOS" "generic/platform=iOS" "generic/platform=watchOS" "generic/platform=tvOS" ) | ||
DIR=$(xcodebuild -project SwiftUIPager.xcodeproj -showBuildSettings | grep -m 1 "BUILD_DIR" | grep -oEi "\/.*") | ||
rm -rd $DIR | ||
|
||
for i in ${!SCHEMES[@]}; do | ||
xcodebuild clean build -scheme ${SCHEMES[$i]} \ | ||
-project SwiftUIPager.xcodeproj \ | ||
-destination "${PLATFORMS[$i]}" | xcpretty | ||
|
||
COUNT=$(find $DIR -maxdepth 1 -type d | wc -l) | ||
if [ $COUNT -eq 2 ]; then | ||
echo "$(tput setaf 2)Build succeded for target ${SCHEMES[$i]}$(tput sgr0)" | ||
else | ||
echo "$(tput setaf 1)Build failed for target ${SCHEMES[$i]}$(tput sgr0)" | ||
exit 1 | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
gem install xcpretty | ||
|
||
LIB_NAME="SwiftUIPager" | ||
PROJ_PATH="$LIB_NAME.xcodeproj" | ||
BUILD_PATH=".build" | ||
FRAMEWORKS_PATH="$BUILD_PATH/frameworks" | ||
XCFRAMEWORK_PATH="$BUILD_PATH/$LIB_NAME.xcframework" | ||
XCFRAMEWORK_ZIP_PATH="$XCFRAMEWORK_PATH.zip" | ||
rm $XCFRAMEWORK_ZIP_PATH | ||
|
||
SCHEMES=( SwiftUIPager_Catalyst SwiftUIPager_macOS SwiftUIPager_iOS SwiftUIPager_watchOS SwiftUIPager_tvOS ) | ||
PLATFORMS=( | ||
"platform=macOS,variant=Mac Catalyst" | ||
"platform=macOS" | ||
"generic/platform=iOS;generic/platform=iOS Simulator" | ||
"generic/platform=watchOS;generic/platform=watchOS Simulator" | ||
"generic/platform=tvOS;generic/platform=tvOS Simulator" | ||
) | ||
ARCHIVES=( | ||
"$LIB_NAME.macCatalyst.xcarchive" | ||
"$LIB_NAME.macos.xcarchive" | ||
"$LIB_NAME.iOS.xcarchive;SwiftUIPager.iOS-simulator.xcarchive" | ||
"$LIB_NAME.watchOS.xcarchive;SwiftUIPager.watchOS-simulator.xcarchive" | ||
"$LIB_NAME.tvOS.xcarchive;SwiftUIPager.tvOS-simulator.xcarchive" | ||
) | ||
|
||
COMMAND="xcodebuild -create-xcframework " | ||
xcodebuild clean -project $PROJ_PATH | ||
for i in ${!SCHEMES[@]}; do | ||
IFS=";" read -r -a PLATFORM <<< "${PLATFORMS[i]}" | ||
IFS=";" read -r -a ARCHIVE <<< "${ARCHIVES[i]}" | ||
|
||
for j in ${!PLATFORM[@]}; do | ||
ARCHIVE_PATH="$FRAMEWORKS_PATH/${ARCHIVE[$j]}" | ||
xcodebuild archive -scheme ${SCHEMES[$i]} \ | ||
-project $PROJ_PATH \ | ||
-destination "${PLATFORM[$j]}" \ | ||
-archivePath $ARCHIVE_PATH \ | ||
SKIP_INSTALL=NO \ | ||
BUILD_LIBRARY_FOR_DISTRIBUTION=YES | xcpretty | ||
|
||
COMMAND="$COMMAND -framework $ARCHIVE_PATH/Products/Library/Frameworks/$LIB_NAME.framework" | ||
done | ||
|
||
done | ||
COMMAND="$COMMAND -output $XCFRAMEWORK_PATH" | ||
$COMMAND | xcpretty | ||
rm -rd $FRAMEWORKS_PATH | ||
zip -r $XCFRAMEWORK_ZIP_PATH $XCFRAMEWORK_PATH | ||
rm -rd $XCFRAMEWORK_PATH | ||
echo ::set-output name=path::$XCFRAMEWORK_ZIP_PATH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
FOLDER=$(echo $GITHUB_REPOSITORY | cut -d'/' -f2) | ||
|
||
git clone https://x-access-token:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git | ||
cd $FOLDER | ||
git checkout $OUTDATED_BRANCH | ||
|
||
echo Adding origin as $GITHUB_REPOSITORY | ||
git remote set-url origin https://x-access-token:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git | ||
git config --global user.email "$USER_EMAIL" | ||
git config --global user.name "$USER_NAME" | ||
|
||
git fetch origin $BASE_BRANCH | ||
|
||
echo git pull --rebase origin $OUTDATED_BRANCH | ||
git pull --rebase origin $OUTDATED_BRANCH | ||
|
||
echo Rebasing $BASE_BRANCH onto $OUTDATED_BRANCH | ||
echo git rebase origin/$BASE_BRANCH | ||
git rebase origin/$BASE_BRANCH | ||
|
||
echo git push --force-with-lease origin $OUTDATED_BRANCH | ||
git push --force-with-lease origin $OUTDATED_BRANCH | ||
|
||
cd .. | ||
rm -rf $FOLDER |