From 16af3f4c78c39ef551fe85d1f3964f7b298eb15e Mon Sep 17 00:00:00 2001 From: thunderbiscuit Date: Tue, 21 Nov 2023 14:22:23 -0500 Subject: [PATCH] build: update release workflow --- .github/workflows/publish-spm.yaml | 61 ++++++++++++------------------ 1 file changed, 24 insertions(+), 37 deletions(-) diff --git a/.github/workflows/publish-spm.yaml b/.github/workflows/publish-spm.yaml index 72423e1..edd99c7 100644 --- a/.github/workflows/publish-spm.yaml +++ b/.github/workflows/publish-spm.yaml @@ -16,74 +16,61 @@ jobs: name: Build, tag and create release runs-on: macos-12 steps: - - name: Checkout build repo + - name: "Checkout build repo" uses: actions/checkout@v3 with: repository: ${{ github.repository_owner }}/bdk-ffi path: build ref: ${{ inputs.ffitag }} - - name: Checkout dist repo + - name: "Checkout dist repo" uses: actions/checkout@v3 with: path: dist - - name: Install Rust targets - working-directory: build + - name: "Install Rust targets" + working-directory: build/bdk-ffi run: | - rustup install nightly-2023-04-10 - rustup component add rust-src --toolchain nightly-2023-04-10 - rustup target add aarch64-apple-ios x86_64-apple-ios - rustup target add aarch64-apple-ios-sim --toolchain nightly-2023-04-10 - rustup target add aarch64-apple-darwin x86_64-apple-darwin + rustup install 1.73.0 + rustup component add rust-src + rustup target add aarch64-apple-ios # iOS ARM64 + rustup target add x86_64-apple-ios # iOS x86_64 + rustup target add aarch64-apple-ios-sim # simulator mac M1 + rustup target add aarch64-apple-darwin # mac M1 + rustup target add x86_64-apple-darwin # mac x86_64 - - name: Run bdk-ffi-bindgen + - name: "Run bdk-ffi-bindgen" working-directory: build/bdk-ffi run: | cargo run --bin uniffi-bindgen generate src/bdk.udl --language swift --out-dir ../bdk-swift/Sources/BitcoinDevKit --no-format - - name: Build bdk-ffi for x86_64-apple-darwin - working-directory: build + + - name: "Build bdk-ffi for all targets" + working-directory: build/bdk-ffi run: | cargo build --profile release-smaller --target x86_64-apple-darwin - - - name: Build bdk-ffi for aarch64-apple-darwin - working-directory: build - run: | cargo build --profile release-smaller --target aarch64-apple-darwin - - - name: Build bdk-ffi for x86_64-apple-ios - working-directory: build - run: | cargo build --profile release-smaller --target x86_64-apple-ios - - - name: Build bdk-ffi for aarch64-apple-ios - working-directory: build - run: | cargo build --profile release-smaller --target aarch64-apple-ios + cargo build --profile release-smaller --target aarch64-apple-ios-sim - - name: Build bdk-ffi for aarch64-apple-ios-sim - working-directory: build - run: | - cargo +nightly-2023-04-10 build --profile release-smaller --target aarch64-apple-ios-sim - - - name: Create lipo-ios-sim and lipo-macos - working-directory: build + - name: "Create lipo-ios-sim and lipo-macos" + working-directory: build/bdk-ffi run: | mkdir -p target/lipo-ios-sim/release-smaller lipo target/aarch64-apple-ios-sim/release-smaller/libbdkffi.a target/x86_64-apple-ios/release-smaller/libbdkffi.a -create -output target/lipo-ios-sim/release-smaller/libbdkffi.a mkdir -p target/lipo-macos/release-smaller lipo target/aarch64-apple-darwin/release-smaller/libbdkffi.a target/x86_64-apple-darwin/release-smaller/libbdkffi.a -create -output target/lipo-macos/release-smaller/libbdkffi.a - - name: Create bdkFFI.xcframework + - name: "Create bdkFFI.xcframework" working-directory: build/bdk-swift run: | mv Sources/BitcoinDevKit/bdk.swift Sources/BitcoinDevKit/BitcoinDevKit.swift cp Sources/BitcoinDevKit/bdkFFI.h bdkFFI.xcframework/ios-arm64/bdkFFI.framework/Headers cp Sources/BitcoinDevKit/bdkFFI.h bdkFFI.xcframework/ios-arm64_x86_64-simulator/bdkFFI.framework/Headers cp Sources/BitcoinDevKit/bdkFFI.h bdkFFI.xcframework/macos-arm64_x86_64/bdkFFI.framework/Headers - cp ../target/aarch64-apple-ios/release-smaller/libbdkffi.a bdkFFI.xcframework/ios-arm64/bdkFFI.framework/bdkFFI - cp ../target/lipo-ios-sim/release-smaller/libbdkffi.a bdkFFI.xcframework/ios-arm64_x86_64-simulator/bdkFFI.framework/bdkFFI - cp ../target/lipo-macos/release-smaller/libbdkffi.a bdkFFI.xcframework/macos-arm64_x86_64/bdkFFI.framework/bdkFFI + cp ../bdk-ffi/target/aarch64-apple-ios/release-smaller/libbdkffi.a bdkFFI.xcframework/ios-arm64/bdkFFI.framework/bdkFFI + cp ../bdk-ffi/target/lipo-ios-sim/release-smaller/libbdkffi.a bdkFFI.xcframework/ios-arm64_x86_64-simulator/bdkFFI.framework/bdkFFI + cp ../bdk-ffi/target/lipo-macos/release-smaller/libbdkffi.a bdkFFI.xcframework/macos-arm64_x86_64/bdkFFI.framework/bdkFFI rm Sources/BitcoinDevKit/bdkFFI.h rm Sources/BitcoinDevkit/bdkFFI.modulemap rm bdkFFI.xcframework.zip || true @@ -91,7 +78,7 @@ jobs: echo "BDKFFICHECKSUM=`swift package compute-checksum bdkFFI.xcframework.zip`" >> $GITHUB_ENV echo "BDKFFIURL=https\:\/\/github\.com\/${{ github.repository_owner }}\/bdk\-swift\/releases\/download\/${{ inputs.version }}\/bdkFFI\.xcframework\.zip" >> $GITHUB_ENV - - name: Update and tag release dist repo + - name: "Update and tag release dist repo" working-directory: build/bdk-swift run: | echo checksum = ${{ env.BDKFFICHECKSUM }} @@ -106,7 +93,7 @@ jobs: git tag ${{ inputs.version }} -m "Release ${{ inputs.version }}" git push --tags - - name: Create release + - name: "Create release" uses: ncipollo/release-action@v1 with: artifacts: "build/bdk-swift/bdkFFI.xcframework.zip"