From 93da4975375528bbd31b3cb02dcc98a7efbe3570 Mon Sep 17 00:00:00 2001 From: Lucas Romano Date: Fri, 29 Nov 2024 15:02:36 -0300 Subject: [PATCH] ajust to build static and dynamic --- .github/workflows/release.yml | 105 +++++++++++++++++++++++----------- SkeletonView.podspec | 10 ++++ 2 files changed, 82 insertions(+), 33 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 850251f6..cbc8e240 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,5 @@ -name: Release +name: CD + on: workflow_dispatch: pull_request_target: @@ -16,25 +17,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", + mach_o_type: "mh_dylib", + archive_path: "build/Release-iphonesimulator/Dynamic", + } + - { + scheme: "SkeletonView tvOS", + destination: "generic/platform=tvOS", + sdk: "appletvos", + mach_o_type: "mh_dylib", + archive_path: "build/Release-appletvos/Dynamic", + } + - { + scheme: "SkeletonView tvOS", + destination: "generic/platform=tvOS Simulator", + sdk: "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", - archive_path: "build/Release-iphonesimulator", + mach_o_type: "staticlib", + archive_path: "build/Release-iphonesimulator/Static", } - { scheme: "SkeletonView tvOS", destination: "generic/platform=tvOS", sdk: "appletvos", - archive_path: "build/Release-appletvos", + mach_o_type: "staticlib", + archive_path: "build/Release-appletvos/Static", } - { scheme: "SkeletonView tvOS", destination: "generic/platform=tvOS Simulator", sdk: "appletvsimulator", - archive_path: "build/Release-appletvsimulator", + mach_o_type: "staticlib", + archive_path: "build/Release-appletvsimulator/Static", } steps: @@ -46,15 +79,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: @@ -74,25 +108,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 @@ -102,31 +146,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 }} diff --git a/SkeletonView.podspec b/SkeletonView.podspec index b6159964..0ab78d3f 100644 --- a/SkeletonView.podspec +++ b/SkeletonView.podspec @@ -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