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
  • Loading branch information
lucasromanomr authored Nov 29, 2024
1 parent 917a9b2 commit efa541e
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 55 deletions.
51 changes: 4 additions & 47 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,11 @@
name: CD

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

jobs:
release_version:
if: github.event.pull_request.milestone == null && github.event.pull_request.merged == true
runs-on: macOS-latest
steps:
- uses: actions/checkout@v2

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

- name: Update podspec
run: fastlane bump_version next_version:${{ steps.publish_release.outputs.tag_name }}

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: 'main'
commit_message: 'Bump version ${{ steps.publish_release.outputs.tag_name }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Deploy to Cocoapods
continue-on-error: true
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
run: |
set -eo pipefail
pod lib lint --allow-warnings
pod trunk push --allow-warnings
- name: Tweet the release
uses: ethomson/send-tweet-action@v1
with:
consumer-key: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
consumer-secret: ${{ secrets.TWITTER_CONSUMER_API_SECRET }}
access-token: ${{ secrets.TWITTER_ACCESS_TOKEN }}
access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
status: |
🎉 New release ${{ steps.publish_release.outputs.tag_name }} is out 🚀
Check out all the changes here:
${{ steps.publish_release.outputs.html_url }}
jobs:
call_reusable_workflow:
uses: ./.github/workflows/release.yml
103 changes: 98 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,100 @@
name: Release
on: [workflow_dispatch]
on: [workflow_dispatch, workflow_call:]

jobs:
build:
name: Build XCFramework for Multiple Platforms
runs-on: macos-latest
strategy:
matrix:
build-config:
- {
scheme: "SkeletonView iOS",
destination: "generic/platform=iOS",
sdk: "iphoneos",
archive_path: "build/Release-iphoneos",
}
- {
scheme: "SkeletonView iOS",
destination: "generic/platform=iOS Simulator",
sdk: "iphonesimulator",
archive_path: "build/Release-iphonesimulator",
}
- {
scheme: "SkeletonView tvOS",
destination: "generic/platform=tvOS",
sdk: "appletvos",
archive_path: "build/Release-appletvos",
}
- {
scheme: "SkeletonView tvOS",
destination: "generic/platform=tvOS Simulator",
sdk: "appletvsimulator",
archive_path: "build/Release-appletvsimulator",
}

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

- name: Build framework
run: |
xcodebuild archive \
-scheme "${{ matrix.build-config.scheme }}" \
-destination "${{ matrix.build-config.destination }}" \
-sdk "${{ matrix.build-config.sdk }}" \
-archivePath "${{ matrix.build-config.archive_path }}/SkeletonView.xcarchive" \
SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES
create-xcframework:
name: Create XCFramework
needs: build
runs-on: macos-latest

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

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

- name: Create XCFramework
run: |
xcodebuild -create-xcframework \
-framework build/Release-iphoneos/SkeletonView.xcarchive/Products/Library/Frameworks/SkeletonView.framework \
-framework build/Release-iphonesimulator/SkeletonView.xcarchive/Products/Library/Frameworks/SkeletonView.framework \
-framework build/Release-appletvos/SkeletonView.xcarchive/Products/Library/Frameworks/SkeletonView.framework \
-framework build/Release-appletvsimulator/SkeletonView.xcarchive/Products/Library/Frameworks/SkeletonView.framework \
-output build/XCFramework/SkeletonView.xcframework
- name: Verify XCFramework
run: |
if [ -d "build/XCFramework/SkeletonView.xcframework" ]; then
echo "XCFramework generated successfully."
else
echo "Failed to generate XCFramework." && exit 1
fi
- name: Upload XCFramework
uses: actions/upload-artifact@v4
with:
name: SkeletonView-XCFramework
path: build/XCFramework/SkeletonView.xcframework

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 XCFramework
uses: actions/download-artifact@v3
with:
name: SkeletonView-XCFramework

- name: Publish release
id: publish_release
Expand All @@ -15,7 +104,11 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update podspec
- name: Update podspec with XCFramework
run: |
sed -i '' 's|vendored_frameworks = .*|vendored_frameworks = "build/XCFramework/SkeletonView.xcframework"|' SkeletonView.podspec
- name: Update version in podspec
run: fastlane bump_version next_version:${{ steps.publish_release.outputs.tag_name }}

- name: Commit changes
Expand All @@ -26,7 +119,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

0 comments on commit efa541e

Please sign in to comment.