diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml new file mode 100644 index 00000000..4729b625 --- /dev/null +++ b/.github/workflows/CD.yml @@ -0,0 +1,54 @@ +name: "SDWebImage CD" + +on: + push: + # Pattern matched against refs/tags + tags: + - '*' + +jobs: + Release: + name: Release XCFramework + runs-on: macos-14 + env: + CODESIGN_KEY_BASE64: "${{ secrets.CODESIGN_KEY_BASE64 }}" + DEVELOPER_DIR: /Applications/Xcode_15.2.app + strategy: + fail-fast: true + matrix: + linkage: [dynamic, static] + include: + - linkage: dynamic + MACH_O_TYPE: mh_dylib + - linkage: static + MACH_O_TYPE: staticlib + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Build XCFramework + run: | + set -o pipefail + export MACH_O_TYPE="${{ matrix.MACH_O_TYPE }}" + ./Scripts/build-frameworks.sh + rm -rf ~/Library/Developer/Xcode/DerivedData/ + + - name: Create XCFramework + run: | + set -o pipefail + ./Scripts/create-xcframework.sh + ./Scripts/sign-xcframework.sh + + - name: Archive XCFramework + run: | + cd build + zip -r SDWebImage-${{ matrix.linkage }}.xcframework.zip SDWebImage.xcframework + cd ../ + rm -rf build + + - uses: softprops/action-gh-release@v0.1.15 + env: + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GITHUB_REPOSITORY: "${{ github.repository }}" + with: + files: "SDWebImage-${{ matrix.linkage }}.xcframework.zip" diff --git a/.github/workflows/Release.yml b/.github/workflows/Release.yml deleted file mode 100644 index 687800cf..00000000 --- a/.github/workflows/Release.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: "SDWebImage Release" - -on: - push: - # Pattern matched against refs/tags - tags: - - '*' - -jobs: - Release: - name: Release XCFramework - runs-on: macos-14 - env: - DEVELOPER_DIR: /Applications/Xcode_15.2.app - PROJECT_NAME: SDWebImage.xcodeproj - SCHEME_NAME: SDWebImage XCFramework - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Build dynamic XCFramework - run: | - set -o pipefail - export MACH_O_TYPE=mh_dylib - xcodebuild build -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.SCHEME_NAME }}" - rm -rf ~/Library/Developer/Xcode/DerivedData/ - - - name: Archive dynamic XCFramework - run: | - cd "${{ github.workspace }}" - zip -y -r SDWebImage-dynamic.xcframework.zip build/SDWebImage.xcframework - rm -rf build - - - name: Build static XCFramework - run: | - set -o pipefail - export MACH_O_TYPE=staticlib - xcodebuild build -project "${{ env.PROJECT_NAME }}" -scheme "${{ env.SCHEME_NAME }}" - rm -rf ~/Library/Developer/Xcode/DerivedData/ - - - name: Archive static XCFramework - run: | - cd "${{ github.workspace }}" - zip -y -r SDWebImage-static.xcframework.zip build/SDWebImage.xcframework - rm -rf build - - - uses: softprops/action-gh-release@v0.1.15 - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - GITHUB_REPOSITORY: "${{ github.repository }}" - with: - files: ["${{ github.workspace }}/SDWebImage-dynamic.xcframework.zip", "${{ github.workspace }}/SDWebImage-static.xcframework.zip"] diff --git a/Scripts/sign-xcframework.sh b/Scripts/sign-xcframework.sh index 7b5ab374..c4484545 100755 --- a/Scripts/sign-xcframework.sh +++ b/Scripts/sign-xcframework.sh @@ -1,6 +1,7 @@ #!/bin/bash set -e +set -x set -o pipefail if [ -z "$SRCROOT" ] @@ -9,7 +10,7 @@ then fi # Self-sign XCFramework -if [ -z CODESIGN_KEY_BASE64 ]; then +if [ -z $CODESIGN_KEY_BASE64 ]; then echo "Ignore Codesign XCFramework! You must sign SDWebImage before shipping to App Store. See: https://developer.apple.com/support/third-party-SDK-requirements" exit 0 fi @@ -24,10 +25,10 @@ echo $CODESIGN_KEY_BASE64 | base64 -D > "$(PWD)/Certificate/${CODESIGN_IDENTIFY_ security create-keychain -p "$KEYCHAIN_PASSWORD" ios.keychain security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN -security import "$(PWD)/Certificate/${CODESIGN_IDENTIFY_NAME}.cer" -k $KEYCHAIN -T /usr/bin/codesign -T /usr/bin/security -security import "$(PWD)/Certificate/${CODESIGN_IDENTIFY_NAME}.p12" -k $KEYCHAIN -P "$KEY_PASSWORD" -T /usr/bin/codesign -T /usr/bin/security +security import "$(PWD)/Certificate/${CODESIGN_IDENTIFY_NAME}.cer" -k $KEYCHAIN -T /usr/bin/codesign +security import "$(PWD)/Certificate/${CODESIGN_IDENTIFY_NAME}.p12" -k $KEYCHAIN -P "$KEY_PASSWORD" -T /usr/bin/codesign security list-keychains -s ios.keychain -security set-key-partition-list -S "apple-tool:,apple:" -k "$KEYCHAIN_PASSWORD" $KEYCHAIN +security set-key-partition-list -S apple-tool:,apple: -s -k "$KEYCHAIN_PASSWORD" $KEYCHAIN echo "Codesign XCFramework" /usr/bin/codesign --force --timestamp -v --sign "SDWebImage Signing Certificate" "${SRCROOT}/build/SDWebImage.xcframework"