Skip to content

Commit

Permalink
Feature/update cd xcframeworks (#4)
Browse files Browse the repository at this point in the history
* fix validations

fix SwiftLint

* add PrivacyInfo.xcprivacy

* fix iPhone version to build

* fix bug on Xcode 16 - iOS12

* remove strict swiftlint

* fix Twiteet step on release workflow

* revert validations jobs

* release xcframework for default

* add manual

* change CD

remove cd (#5)

create xcframework

fix pod spec

ajust to build static and dynamic
  • Loading branch information
lucasromanomr committed Nov 29, 2024
1 parent 11849e2 commit eaa4244
Show file tree
Hide file tree
Showing 4 changed files with 174 additions and 66 deletions.
54 changes: 0 additions & 54 deletions .github/workflows/CD.yml

This file was deleted.

166 changes: 159 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,173 @@
name: Release
on: [workflow_dispatch]
name: CD

on:
workflow_dispatch:
pull_request_target:
branches: [main]
types: [closed]

jobs:
build:
name: Build XCFramework
runs-on: macos-latest
strategy:
matrix:
build-config:
- {
scheme: "SkeletonView iOS",
destination: "generic/platform=iOS",
sdk: "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",
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:
- name: Checkout code
uses: actions/checkout@v4

- name: Build framework
run: |
xcodebuild archive \
-scheme "${{ matrix.build-config.scheme }}" \
-destination "${{ matrix.build-config.destination }}" \
-configuration "Release" \
-sdk "${{ matrix.build-config.sdk }}" \
-archivePath "${{ matrix.build-config.archive_path }}/SkeletonView.xcarchive" \
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-${{ matrix.build-config.mach_o_type }}
path: ${{ matrix.build-config.archive_path }}

create-xcframework:
name: Create XCFramework
needs: build
runs-on: macos-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: build/

- name: Verify downloaded artifacts
run: ls -R build/

- 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-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 XCFrameworks
run: |
cd build/XCFramework
zip -r SkeletonViewStatic.xcframework.zip SkeletonViewStatic.xcframework
zip -r SkeletonViewDynamic.xcframework.zip SkeletonViewDynamic.xcframework
- name: Upload XCFrameworks as Artifacts
uses: actions/upload-artifact@v3
with:
name: XCFrameworks-Zip
path: build/XCFramework/*.xcframework.zip

release_version:
runs-on: macOS-latest
name: Release Version
needs: create-xcframework
runs-on: macos-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Download XCFrameworks ZIP
uses: actions/download-artifact@v3
with:
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: Update podspec
- name: Publish XCFrameworks
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.publish_release.outputs.tag_name }}
files: |
SkeletonViewDynamic.xcframework.zip
SkeletonViewStatic.xcframework.zip
- name: Update version in podspec
run: fastlane bump_version next_version:${{ steps.publish_release.outputs.tag_name }}

- name: Commit changes
Expand All @@ -26,7 +178,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Deploy to Cocoapods
- name: Deploy to CocoaPods
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
run: |
Expand Down
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// swift-tools-version:5.3
// swift-tools-version:5.10

import PackageDescription

let package = Package(
name: "SkeletonView",
platforms: [
.iOS(.v9),
.tvOS(.v9)
.iOS(.v12),
.tvOS(.v12)
],
products: [
.library(
Expand Down
14 changes: 12 additions & 2 deletions SkeletonView.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,18 @@ Pod::Spec.new do |s|
s.social_media_url = "https://x.com/JuanpeCatalan"
s.ios.deployment_target = "12.0"
s.tvos.deployment_target = "12.0"
s.swift_version = "5.10"
s.swift_version = "5.0"
s.source = { :git => "https://github.com/Juanpe/SkeletonView.git", :tag => s.version.to_s }
s.source_files = "SkeletonViewCore/Sources/**/*.{swift,h}"
s.resource_bundles = {"SkeletonView" => ["SkeletonViewCore/Sources/Supporting Files/PrivacyInfo.xcprivacy"]}
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 eaa4244

Please sign in to comment.