Skip to content

Commit

Permalink
ajust to build static and dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasromanomr committed Nov 29, 2024
1 parent 49d06ad commit d843228
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 32 deletions.
102 changes: 70 additions & 32 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,57 @@ jobs:
scheme: "SkeletonView iOS",
destination: "generic/platform=iOS",
sdk: "iphoneos",
archive_path: "build/Release-iphoneos",
mach_o_type: "mh_dylib",
archive_path: "build/Release-iphoneos/Dynamic",
}
- {
scheme: "SkeletonView iOS",
destination: "generic/platform=iOS Simulator",
sdk: "iphonesimulator",
archive_path: "build/Release-iphonesimulator",
mach_o_type: "mh_dylib",
archive_path: "build/Release-iphonesimulator/Dynamic",
}
- {
scheme: "SkeletonView tvOS",
destination: "generic/platform=tvOS",
sdk: "appletvos",
archive_path: "build/Release-appletvos",
mach_o_type: "mh_dylib",
archive_path: "build/Release-appletvos/Dynamic",
}
- {
scheme: "SkeletonView tvOS",
destination: "generic/platform=tvOS Simulator",
sdk: "appletvsimulator",
archive_path: "build/Release-appletvsimulator",
mach_o_type: "mh_dylib",
archive_path: "build/Release-appletvsimulator/Dynamic",
}
- {
scheme: "SkeletonView iOS",
destination: "generic/platform=iOS",
sdk: "iphoneos",
mach_o_type: "staticlib",
archive_path: "build/Release-iphoneos/Static",
}
- {
scheme: "SkeletonView iOS",
destination: "generic/platform=iOS Simulator",
sdk: "iphonesimulator",
mach_o_type: "staticlib",
archive_path: "build/Release-iphonesimulator/Static",
}
- {
scheme: "SkeletonView tvOS",
destination: "generic/platform=tvOS",
sdk: "appletvos",
mach_o_type: "staticlib",
archive_path: "build/Release-appletvos/Static",
}
- {
scheme: "SkeletonView tvOS",
destination: "generic/platform=tvOS Simulator",
sdk: "appletvsimulator",
mach_o_type: "staticlib",
archive_path: "build/Release-appletvsimulator/Static",
}

steps:
Expand All @@ -46,15 +78,16 @@ jobs:
xcodebuild archive \
-scheme "${{ matrix.build-config.scheme }}" \
-destination "${{ matrix.build-config.destination }}" \
-configuration Release \
-configuration "Release" \
-sdk "${{ matrix.build-config.sdk }}" \
-archivePath "${{ matrix.build-config.archive_path }}/SkeletonView.xcarchive" \
SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES
SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
MACH_O_TYPE=${{ matrix.build-config.mach_o_type }}
- name: Upload archive as artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.build-config.sdk }}-build
name: ${{ matrix.build-config.sdk }}-build-${{ matrix.build-config.mach_o_type }}
path: ${{ matrix.build-config.archive_path }}

create-xcframework:
Expand All @@ -74,25 +107,35 @@ jobs:
- name: Verify downloaded artifacts
run: ls -R build/

- name: Create XCFramework
- name: Create Static XCFramework
run: |
xcodebuild -create-xcframework \
-framework build/iphoneos-build-staticlib/SkeletonView.xcarchive/Products/Library/Frameworks/SkeletonView.framework \
-framework build/iphonesimulator-build-staticlib/SkeletonView.xcarchive/Products/Library/Frameworks/SkeletonView.framework \
-framework build/appletvos-build-staticlib/SkeletonView.xcarchive/Products/Library/Frameworks/SkeletonView.framework \
-framework build/appletvsimulator-build-staticlib/SkeletonView.xcarchive/Products/Library/Frameworks/SkeletonView.framework \
-output build/XCFramework/SkeletonViewStatic.xcframework
- name: Create Dynamic XCFramework
run: |
xcodebuild -create-xcframework \
-framework build/iphoneos-build/SkeletonView.xcarchive/Products/Library/Frameworks/SkeletonView.framework \
-framework build/iphonesimulator-build/SkeletonView.xcarchive/Products/Library/Frameworks/SkeletonView.framework \
-framework build/appletvos-build/SkeletonView.xcarchive/Products/Library/Frameworks/SkeletonView.framework \
-framework build/appletvsimulator-build/SkeletonView.xcarchive/Products/Library/Frameworks/SkeletonView.framework \
-output build/XCFramework/SkeletonView.xcframework
-framework build/iphoneos-build-mh_dylib/SkeletonView.xcarchive/Products/Library/Frameworks/SkeletonView.framework \
-framework build/iphonesimulator-build-mh_dylib/SkeletonView.xcarchive/Products/Library/Frameworks/SkeletonView.framework \
-framework build/appletvos-build-mh_dylib/SkeletonView.xcarchive/Products/Library/Frameworks/SkeletonView.framework \
-framework build/appletvsimulator-build-mh_dylib/SkeletonView.xcarchive/Products/Library/Frameworks/SkeletonView.framework \
-output build/XCFramework/SkeletonViewDynamic.xcframework
- name: Compress XCFramework
- name: Compress XCFrameworks
run: |
cd build/XCFramework
zip -r SkeletonView.xcframework.zip SkeletonView.xcframework
zip -r SkeletonViewStatic.xcframework.zip SkeletonViewStatic.xcframework
zip -r SkeletonViewDynamic.xcframework.zip SkeletonViewDynamic.xcframework
- name: Upload XCFramework to Release
- name: Upload XCFrameworks as Artifacts
uses: actions/upload-artifact@v3
with:
name: SkeletonView-XCFramework-Zip
path: build/XCFramework/SkeletonView.xcframework.zip
name: XCFrameworks-Zip
path: build/XCFramework/*.xcframework.zip

release_version:
name: Release Version
Expand All @@ -102,31 +145,26 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Download XCFramework ZIP
- name: Download XCFrameworks ZIP
uses: actions/download-artifact@v3
with:
name: SkeletonView-XCFramework-Zip
name: XCFrameworks-Zip

- name: Publish release
id: publish_release
uses: release-drafter/release-drafter@v5
uses: release-drafter/release-drafter@v6
with:
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload XCFramework to GitHub Release
uses: actions/upload-release-asset@v1
- name: Publish XCFrameworks
- uses: d1ceward/release-upload-action@v4
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_path: build/XCFramework/SkeletonView.xcframework.zip
asset_name: SkeletonView.xcframework.zip
asset_content_type: application/zip

- name: Update podspec with XCFramework
run: |
sed -i '' 's|vendored_frameworks = .*|vendored_frameworks = "build/XCFramework/SkeletonView.xcframework"|' SkeletonView.podspec
sed -i '' 's|source = .*|{ :http => "https://github.com/Juanpe/SkeletonView/releases/download/${{ steps.publish_release.outputs.tag_name }}/SkeletonView.xcframework.zip" }|' SkeletonView.podspec
token: ${{ secrets.GITHUB_TOKEN }}
files: |
SkeletonViewDynamic.xcframework.zip
SkeletonViewStatic.xcframework.zip
- name: Update version in podspec
run: fastlane bump_version next_version:${{ steps.publish_release.outputs.tag_name }}
Expand Down
10 changes: 10 additions & 0 deletions SkeletonView.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,14 @@ Pod::Spec.new do |s|
s.source = { :git => "https://github.com/Juanpe/SkeletonView.git", :tag => s.version.to_s }
s.source_files = "SkeletonViewCore/Sources/**/*.{swift,h}"
s.vendored_frameworks = "SkeletonView.xcframework"

# Subspec para o framework estático
s.subspec "Static" do |sp|
sp.vendored_frameworks = "StaticXCFramework.xcframework"
end

# Subspec para o framework dinâmico
s.subspec "Dynamic" do |sp|
sp.vendored_frameworks = "DynamicXCFramework.xcframework"
end
end

0 comments on commit d843228

Please sign in to comment.