-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add swift-create-sign-upload-xcframework GitHub Action workflow (#11)
- Loading branch information
Showing
6 changed files
with
139 additions
and
6 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
.github/workflows/swift-create-sign-upload-xcframework.yml
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,30 @@ | ||
name: swift-create-sign-upload-xcframework | ||
|
||
on: | ||
release: | ||
types: [created] | ||
workflow_dispatch: | ||
|
||
env: | ||
XCFRAMEWORK_OUTPUT_DIR: .xcframework | ||
XCFRAMEWORK_NAME: UIViewKit | ||
XCFRAMEWORK_NAME_WITH_EXTENSION: UIViewKit.xcframework | ||
|
||
jobs: | ||
create-xcframework: | ||
runs-on: macos-latest | ||
steps: | ||
- name: Import Code-Signing Certificates | ||
uses: Apple-Actions/import-codesign-certs@v1 | ||
with: | ||
p12-file-base64: ${{ secrets.CERTIFICATE_P12 }} | ||
p12-password: ${{ secrets.CERTIFICATE_P12_PASSWORD }} | ||
- name: Checkout Project | ||
uses: actions/[email protected] | ||
- name: Build XCFramework | ||
run: ./buildxcf.sh | ||
- name: Upload XCFramework as Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ env.XCFRAMEWORK_NAME_WITH_EXTENSION }} | ||
path: ${{ env.XCFRAMEWORK_OUTPUT_DIR }}/${{ env.XCFRAMEWORK_NAME_WITH_EXTENSION }} |
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
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,42 @@ | ||
// | ||
// IBMeasure.swift | ||
// UIViewKit | ||
// | ||
// Created by Blazej SLEBODA on 11/03/2024. | ||
// | ||
|
||
import UIKit | ||
|
||
public final class IBMeasure { | ||
|
||
private init() {} | ||
|
||
@MainActor | ||
public static func printVerticalDistance(from: NSLayoutAnchor<NSLayoutYAxisAnchor>, to: NSLayoutAnchor<NSLayoutYAxisAnchor>, rootView: UIView) { | ||
rootView.ibSubviews { | ||
MeasureView().ibAttributes { | ||
$0.widthAnchor.constraint(equalToConstant: 1) | ||
$0.topAnchor.constraint(equalTo: from) | ||
$0.bottomAnchor.constraint(equalTo: to) | ||
} | ||
} | ||
} | ||
|
||
@MainActor | ||
public static func printHorizontalDistance(fromLeft: NSLayoutAnchor<NSLayoutXAxisAnchor>, toRight: NSLayoutAnchor<NSLayoutXAxisAnchor>, rootView: UIView) { | ||
rootView.ibSubviews { | ||
MeasureView().ibAttributes { | ||
$0.heightAnchor.constraint(equalToConstant: 1) | ||
$0.leftAnchor.constraint(equalTo: fromLeft) | ||
$0.rightAnchor.constraint(equalTo: toRight) | ||
} | ||
} | ||
} | ||
|
||
private class MeasureView: UIView { | ||
override func layoutSubviews() { | ||
super.layoutSubviews() | ||
print(frame.height) | ||
} | ||
} | ||
} |
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,38 @@ | ||
#!/bin/bash | ||
|
||
echo "::group::Clean previous builds" | ||
rm -rf $XCFRAMEWORK_OUTPUT_DIR | ||
mkdir $XCFRAMEWORK_OUTPUT_DIR | ||
echo "::endgroup::" | ||
|
||
echo "::group::Build for iOS" | ||
xcodebuild archive \ | ||
-scheme $XCFRAMEWORK_NAME \ | ||
-destination 'generic/platform=iOS' \ | ||
-archivePath "$XCFRAMEWORK_OUTPUT_DIR/ios" \ | ||
SKIP_INSTALL=NO \ | ||
BUILD_LIBRARY_FOR_DISTRIBUTION=YES | ||
echo "::endgroup::" | ||
|
||
echo "::group::Build for iOS Simulator" | ||
xcodebuild archive \ | ||
-scheme $XCFRAMEWORK_NAME \ | ||
-destination 'generic/platform=iOS Simulator' \ | ||
-archivePath "$XCFRAMEWORK_OUTPUT_DIR/ios_simulator" \ | ||
SKIP_INSTALL=NO \ | ||
BUILD_LIBRARY_FOR_DISTRIBUTION=YES | ||
echo "::endgroup::" | ||
|
||
echo "::group::Create XCFramework" | ||
xcodebuild -create-xcframework \ | ||
-framework "$XCFRAMEWORK_OUTPUT_DIR/ios.xcarchive/Products/Library/Frameworks/$XCFRAMEWORK_NAME.framework" \ | ||
-framework "$XCFRAMEWORK_OUTPUT_DIR/ios_simulator.xcarchive/Products/Library/Frameworks/$XCFRAMEWORK_NAME.framework" \ | ||
-output "$XCFRAMEWORK_OUTPUT_DIR/$XCFRAMEWORK_NAME.xcframework" | ||
echo "::endgroup::" | ||
|
||
echo "::group::Sign XCFramework" | ||
codesign -s "iPhone Distribution: Blazej SLEBODA (43VBDTY4E3)" \ | ||
--force \ | ||
--deep \ | ||
-- $XCFRAMEWORK_OUTPUT_DIR/$XCFRAMEWORK_NAME_WITH_EXTENSION | ||
echo "::endgroup::" |