|
| 1 | +name: ARK Drop Swift Bindings Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + paths: |
| 6 | + - "drop-core/entities/**" |
| 7 | + - "drop-core/exchanges/**" |
| 8 | + - "drop-core/uniffi/**" |
| 9 | + - ".github/workflows/arkdrop-swift-bindings-release.yml" |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +jobs: |
| 13 | + build-and-publish: |
| 14 | + runs-on: macos-latest |
| 15 | + permissions: |
| 16 | + contents: write |
| 17 | + packages: write |
| 18 | + |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Install Rust |
| 23 | + uses: dtolnay/rust-toolchain@stable |
| 24 | + with: |
| 25 | + targets: aarch64-apple-ios,x86_64-apple-ios,aarch64-apple-ios-sim,x86_64-apple-darwin,aarch64-apple-darwin |
| 26 | + |
| 27 | + - uses: Swatinem/rust-cache@v2 |
| 28 | + with: |
| 29 | + workspaces: drop-core/uniffi |
| 30 | + |
| 31 | + - name: Install Xcode Command Line Tools |
| 32 | + run: | |
| 33 | + xcode-select --install 2>/dev/null || true |
| 34 | + xcode-select -p |
| 35 | +
|
| 36 | + - name: Generate Swift Bindings |
| 37 | + working-directory: ./drop-core/uniffi/bindings/swift |
| 38 | + run: | |
| 39 | + chmod +x generate-bindings.sh |
| 40 | + ./generate-bindings.sh |
| 41 | +
|
| 42 | + - name: Build XCFramework |
| 43 | + working-directory: ./drop-core/uniffi/bindings/swift |
| 44 | + run: | |
| 45 | + chmod +x build-xcframework.sh |
| 46 | + ./build-xcframework.sh |
| 47 | +
|
| 48 | + - name: Create Swift Package Archive |
| 49 | + working-directory: ./drop-core/uniffi/bindings/swift |
| 50 | + run: | |
| 51 | + # Create a distributable package |
| 52 | + mkdir -p ArkDrop-Swift-Package |
| 53 | + cp -r arkdrop_uniffiFFI.xcframework ArkDrop-Swift-Package/ |
| 54 | + cp drop.swift ArkDrop-Swift-Package/ |
| 55 | + cp Package.swift ArkDrop-Swift-Package/ |
| 56 | + cp arkdrop_uniffiFFI.h ArkDrop-Swift-Package/ |
| 57 | +
|
| 58 | + # Create a zip archive |
| 59 | + zip -r ArkDrop-Swift-Package.zip ArkDrop-Swift-Package/ |
| 60 | +
|
| 61 | + # Also create a checksum |
| 62 | + shasum -a 256 ArkDrop-Swift-Package.zip > ArkDrop-Swift-Package.zip.sha256 |
| 63 | +
|
| 64 | + - name: Upload Build Artifacts |
| 65 | + uses: actions/upload-artifact@v4 |
| 66 | + with: |
| 67 | + name: swift-bindings |
| 68 | + path: | |
| 69 | + drop-core/uniffi/bindings/swift/ArkDrop-Swift-Package.zip |
| 70 | + drop-core/uniffi/bindings/swift/ArkDrop-Swift-Package.zip.sha256 |
| 71 | + retention-days: 30 |
| 72 | + |
| 73 | + - name: Create Release |
| 74 | + if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) |
| 75 | + uses: softprops/action-gh-release@v2 |
| 76 | + with: |
| 77 | + tag_name: swift-bindings-${{ github.run_id }} |
| 78 | + name: Swift Bindings Release ${{ github.run_id }} |
| 79 | + draft: false |
| 80 | + prerelease: false |
| 81 | + files: | |
| 82 | + drop-core/uniffi/bindings/swift/ArkDrop-Swift-Package.zip |
| 83 | + drop-core/uniffi/bindings/swift/ArkDrop-Swift-Package.zip.sha256 |
| 84 | + body: | |
| 85 | + ## Swift Bindings for ARK Drop |
| 86 | +
|
| 87 | + This release contains the Swift bindings for ARK Drop, including: |
| 88 | + - XCFramework for iOS (device and simulator) and macOS |
| 89 | + - Swift source files |
| 90 | + - Swift Package Manager configuration |
| 91 | +
|
| 92 | + ### Installation |
| 93 | +
|
| 94 | + #### Swift Package Manager |
| 95 | +
|
| 96 | + 1. Download and extract `ArkDrop-Swift-Package.zip` |
| 97 | + 2. Add the package to your Xcode project or include it in your `Package.swift`: |
| 98 | +
|
| 99 | + ```swift |
| 100 | + dependencies: [ |
| 101 | + .package(path: "path/to/ArkDrop-Swift-Package") |
| 102 | + ] |
| 103 | + ``` |
| 104 | +
|
| 105 | + #### Manual Installation |
| 106 | +
|
| 107 | + 1. Download `ArkDrop-Swift-Package.zip` |
| 108 | + 2. Extract and add `arkdrop_uniffiFFI.xcframework` to your Xcode project |
| 109 | + 3. Add `drop.swift` to your project sources |
| 110 | +
|
| 111 | + ### Verification |
| 112 | +
|
| 113 | + Verify the package integrity using the SHA256 checksum: |
| 114 | + ```bash |
| 115 | + shasum -a 256 -c ArkDrop-Swift-Package.zip.sha256 |
| 116 | + ``` |
| 117 | +
|
| 118 | + Generated from commit: ${{ github.sha }} |
| 119 | + env: |
| 120 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments