Skip to content

Commit

Permalink
build: update release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
thunderbiscuit committed Nov 21, 2023
1 parent 18fcb36 commit 16af3f4
Showing 1 changed file with 24 additions and 37 deletions.
61 changes: 24 additions & 37 deletions .github/workflows/publish-spm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,82 +16,69 @@ 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
zip -9 -r bdkFFI.xcframework.zip bdkFFI.xcframework
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 }}
Expand All @@ -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"
Expand Down

0 comments on commit 16af3f4

Please sign in to comment.