From 804b69b410998af7a5dcba22c0b1a63488ff1794 Mon Sep 17 00:00:00 2001 From: cnixbtc <111755602+cnixbtc@users.noreply.github.com> Date: Mon, 8 Jul 2024 13:42:12 +0200 Subject: [PATCH 01/15] Build universal binary for ios --- .github/workflows/build-bindings-ios.yml | 45 ++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/.github/workflows/build-bindings-ios.yml b/.github/workflows/build-bindings-ios.yml index 2811d8a82..5011446e0 100644 --- a/.github/workflows/build-bindings-ios.yml +++ b/.github/workflows/build-bindings-ios.yml @@ -72,6 +72,49 @@ jobs: name: sdk-bindings-${{ matrix.target }} path: libs/target/${{ matrix.target }}/release/libbreez_sdk_bindings.a + merge: + runs-on: macOS-latest + needs: build + name: build ios-universal + steps: + - uses: actions/download-artifact@v3 + with: + name: sdk-bindings-aarch64-apple-ios + path: aarch64-apple-ios + + - uses: actions/download-artifact@v3 + with: + name: sdk-bindings-x86_64-apple-ios + path: x86_64-apple-ios + + - uses: actions/download-artifact@v3 + with: + name: sdk-bindings-aarch64-apple-ios-sim + path: aarch64-apple-ios-sim + + - name: Build iOS universal + run: | + mkdir -p ios-universal + mkdir -p ios-universal-sim + # build universal lib for arm device and x86 sim + lipo -create -output ios-universal/libbreez_sdk_bindings.a aarch64-apple-ios/release/libbreez_sdk_bindings.a x86_64-apple-ios/release/libbreez_sdk_bindings.a + # build universal lib for arm sim and x86 sim + lipo -create -output ios-universal-sim/libbreez_sdk_bindings.a aarch64-apple-ios-sim/release/libbreez_sdk_bindings.a x86_64-apple-ios/release/libbreez_sdk_bindings.a + + - name: Archive release + uses: actions/upload-artifact@v3 + with: + name: sdk-bindings-ios-universal + path: | + ios-universal/libbreez_sdk_bindings.a + + - name: Archive release + uses: actions/upload-artifact@v3 + with: + name: sdk-bindings-ios-universal-sim + path: | + ios-universal-sim/libbreez_sdk_bindings.a + build-dummies: if: ${{ inputs.use-dummy-binaries }} runs-on: ubuntu-latest @@ -82,6 +125,8 @@ jobs: aarch64-apple-ios, x86_64-apple-ios, aarch64-apple-ios-sim, + ios-universal, + ios-universal-sim, ] steps: - name: Build dummy ios ${{ matrix.target }} From dadb62d891cfbe6a9aecec6b25d5eb4e037e0563 Mon Sep 17 00:00:00 2001 From: cnixbtc <111755602+cnixbtc@users.noreply.github.com> Date: Mon, 8 Jul 2024 15:02:40 +0200 Subject: [PATCH 02/15] Add workflow to build and publish swift package --- .github/workflows/publish-all-platforms.yml | 31 ++++- .github/workflows/publish-swift.yml | 134 ++++++++++++++++++++ 2 files changed, 160 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/publish-swift.yml diff --git a/.github/workflows/publish-all-platforms.yml b/.github/workflows/publish-all-platforms.yml index df0cccc54..18f945a87 100644 --- a/.github/workflows/publish-all-platforms.yml +++ b/.github/workflows/publish-all-platforms.yml @@ -14,7 +14,7 @@ on: description: 'array of packages to publish (remove what you do not want)' required: true type: string - default: '["csharp", "golang", "maven", "kotlin-mpp", "flutter", "react-native", "python"]' + default: '["csharp", "golang", "maven", "kotlin-mpp", "flutter", "react-native", "python", "swift"]' csharp-ref: description: 'optional commit/tag/branch reference for the C# project. Defaults to ref.' required: false @@ -47,7 +47,7 @@ on: description: 'array of packages to publish (remove what you do not want)' required: true type: string - default: '["csharp", "golang", "maven", "kotlin-mpp", "flutter", "react-native", "python"]' + default: '["csharp", "golang", "maven", "kotlin-mpp", "flutter", "react-native", "python", "swift"]' csharp-ref: description: 'optional commit/tag/branch reference for the C# project. Defaults to ref.' required: false @@ -78,6 +78,7 @@ jobs: flutter-package-version: ${{ (contains(fromJSON(inputs.packages-to-publish), 'flutter') && inputs.package-version) || '' }} react-native-package-version: ${{ (contains(fromJSON(inputs.packages-to-publish), 'react-native') && inputs.package-version) || '' }} python-package-version: ${{ (contains(fromJSON(inputs.packages-to-publish), 'python') && inputs.package-version) || '' }} + swift-package-version: ${{ (contains(fromJSON(inputs.packages-to-publish), 'swift') && inputs.package-version) || '' }} use-dummy-binaries: ${{ inputs.use-dummy-binaries }} publish: ${{ inputs.publish }} steps: @@ -95,12 +96,12 @@ jobs: # (e.g. bindings-windows: true) if you want to test something. repository: ${{ needs.pre-setup.outputs.repository }} bindings-windows: ${{ !!needs.pre-setup.outputs.csharp-package-version || !!needs.pre-setup.outputs.golang-package-version || !!needs.pre-setup.outputs.python-package-version }} - bindings-darwin: ${{ !!needs.pre-setup.outputs.csharp-package-version || !!needs.pre-setup.outputs.golang-package-version || !!needs.pre-setup.outputs.python-package-version }} + bindings-darwin: ${{ !!needs.pre-setup.outputs.csharp-package-version || !!needs.pre-setup.outputs.golang-package-version || !!needs.pre-setup.outputs.python-package-version || !!needs.pre-setup.outputs.swift-package-version }} bindings-linux: ${{ !!needs.pre-setup.outputs.csharp-package-version || !!needs.pre-setup.outputs.golang-package-version || !!needs.pre-setup.outputs.python-package-version }} bindings-android: ${{ !!needs.pre-setup.outputs.kotlin-mpp-package-version || !!needs.pre-setup.outputs.maven-package-version || !!needs.pre-setup.outputs.golang-package-version }} - bindings-ios: ${{ !!needs.pre-setup.outputs.kotlin-mpp-package-version || !!needs.pre-setup.outputs.maven-package-version }} + bindings-ios: ${{ !!needs.pre-setup.outputs.kotlin-mpp-package-version || !!needs.pre-setup.outputs.maven-package-version || !!needs.pre-setup.outputs.swift-package-version }} kotlin: ${{ !!needs.pre-setup.outputs.kotlin-mpp-package-version || !!needs.pre-setup.outputs.maven-package-version || !!needs.pre-setup.outputs.flutter-package-version }} - swift: ${{ !!needs.pre-setup.outputs.flutter-package-version }} + swift: ${{ !!needs.pre-setup.outputs.flutter-package-version || !!needs.pre-setup.outputs.swift-package-version }} python: ${{ !!needs.pre-setup.outputs.python-package-version }} csharp: ${{ !!needs.pre-setup.outputs.csharp-package-version }} golang: ${{ !!needs.pre-setup.outputs.golang-package-version }} @@ -108,6 +109,7 @@ jobs: kotlin-mpp: ${{ !!needs.pre-setup.outputs.kotlin-mpp-package-version }} flutter: ${{ !!needs.pre-setup.outputs.flutter-package-version }} react-native: ${{ !!needs.pre-setup.outputs.react-native-package-version }} + spm-cocoapods: ${{ !!needs.pre-setup.outputs.swift-package-version }} ref: ${{ needs.pre-setup.outputs.ref }} csharp-package-version: ${{ needs.pre-setup.outputs.csharp-package-version || '0.0.2' }} csharp-ref: ${{ needs.pre-setup.outputs.csharp-ref }} @@ -117,6 +119,7 @@ jobs: flutter-package-version: ${{ needs.pre-setup.outputs.flutter-package-version || '0.0.2' }} react-native-package-version: ${{ needs.pre-setup.outputs.react-native-package-version || '0.0.2' }} python-package-version: ${{ needs.pre-setup.outputs.python-package-version || '0.0.2' }} + swift-package-version: ${{ needs.pre-setup.outputs.swift-package-version || '0.0.2' }} publish: ${{ needs.pre-setup.outputs.publish }} use-dummy-binaries: ${{ needs.pre-setup.outputs.use-dummy-binaries }} steps: @@ -288,3 +291,21 @@ jobs: publish: ${{ needs.setup.outputs.publish == 'true' }} secrets: PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }} + + publish-swift: + needs: + - setup + - build-bindings-darwin + - build-bindings-ios + - build-language-bindings + if: ${{ needs.setup.outputs.spm-cocoapods == 'true' }} + uses: ./.github/workflows/publish-swift.yml + with: + repository: ${{ needs.setup.outputs.repository }} + ref: ${{ needs.setup.outputs.ref }} + package-version: ${{ needs.setup.outputs.swift-package-version }} + publish: ${{ needs.setup.outputs.publish == 'true' }} + secrets: + REPO_SSH_KEY: ${{ secrets.REPO_SSH_KEY }} + GITHUB_TOKEN_BREEZ_SDK_SWIFT: ${{ secrets.GITHUB_TOKEN_BREEZ_SDK_SWIFT }} # todo: create token + COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} # todo: create token diff --git a/.github/workflows/publish-swift.yml b/.github/workflows/publish-swift.yml new file mode 100644 index 000000000..ceed7fcc1 --- /dev/null +++ b/.github/workflows/publish-swift.yml @@ -0,0 +1,134 @@ +name: Publish Swift Package & CocoaPod +on: + workflow_call: + inputs: + repository: + description: 'sdk repository, defaults to current repository' + required: false + type: string + ref: + description: 'commit/tag/branch reference' + required: true + type: string + package-version: + description: 'version for the swift package / cocoapod (MAJOR.MINOR.BUILD) (no v prefix)' + required: true + type: string + publish: + description: 'value indicating whether to commit/tag a release.' + required: true + type: boolean + default: true + secrets: + REPO_SSH_KEY: + description: 'ssh key to commit to the breez-sdk-swift repository' + required: true + GITHUB_TOKEN_BREEZ_SDK_SWIFT: + description: 'token to create a release to the breez-sdk-swift repository' + required: true + COCOAPODS_TRUNK_TOKEN: + description: 'token to publish to cocoapods' + required: true + +jobs: + build-tag-release: + runs-on: macos-latest + steps: + - name: Checkout breez-sdk-swift repo + uses: actions/checkout@v3 + with: + repository: breez/breez-sdk-swift + ssh-key: ${{ secrets.REPO_SSH_KEY }} + path: breez-sdk-swift + + - name: Checkout breez-sdk repo + uses: actions/checkout@v3 + with: + repository: ${{ inputs.repository || github.repository }} + ref: ${{ inputs.ref || github.sha }} + path: breez-sdk + + - uses: actions/download-artifact@v4 + with: + name: bindings-swift + path: breez-sdk/libs/sdk-bindings/bindings-swift/Sources/BreezSDK/ + + - uses: actions/download-artifact@v4 + with: + name: sdk-bindings-aarch64-apple-ios + path: breez-sdk/libs/target/aarch64-apple-ios/release/ + + - uses: actions/download-artifact@v4 + with: + name: sdk-bindings-ios-universal-sim + path: breez-sdk/libs/target/ios-universal-sim/release/ + + - uses: actions/download-artifact@v4 + with: + name: sdk-bindings-darwin-universal + path: breez-sdk/libs/target/darwin-universal/release/ + + - name: Create XCFramework + working-directory: breez-sdk/libs/sdk-bindings + run: | + cp bindings-swift/Sources/BreezSDK/breez_sdkFFI.h bindings-swift/breez_sdkFFI.xcframework/ios-arm64/breez_sdkFFI.framework/Headers + cp bindings-swift/Sources/BreezSDK/breez_sdkFFI.h bindings-swift/breez_sdkFFI.xcframework/ios-arm64_x86_64-simulator/breez_sdkFFI.framework/Headers + cp bindings-swift/Sources/BreezSDK/breez_sdkFFI.h bindings-swift/breez_sdkFFI.xcframework/macos-arm64_x86_64/breez_sdkFFI.framework/Headers + cp ../target/aarch64-apple-ios/release/libbreez_sdk_bindings.a bindings-swift/breez_sdkFFI.xcframework/ios-arm64/breez_sdkFFI.framework/breez_sdkFFI + cp ../target/ios-universal-sim/release/libbreez_sdk_bindings.a bindings-swift/breez_sdkFFI.xcframework/ios-arm64_x86_64-simulator/breez_sdkFFI.framework/breez_sdkFFI + cp ../target/darwin-universal/release/libbreez_sdk_bindings.a bindings-swift/breez_sdkFFI.xcframework/macos-arm64_x86_64/breez_sdkFFI.framework/breez_sdkFFI + rm bindings-swift/Sources/BreezSDK/breez_sdkFFI.h + rm bindings-swift/Sources/BreezSDK/breez_sdkFFI.modulemap + + - name: Compress xcframework + working-directory: breez-sdk/libs/sdk-bindings/bindings-swift + run: | + zip -9 -r breez_sdkFFI.xcframework.zip breez_sdkFFI.xcframework + echo "XCF_CHECKSUM=`swift package compute-checksum breez_sdkFFI.xcframework.zip`" >> $GITHUB_ENV + + - name: Update swift package + working-directory: breez-sdk/libs/sdk-bindings/bindings-swift + run: | + # Update package definition + sed 's#.binaryTarget(name: "breez_sdkFFI", path: "./breez_sdkFFI.xcframework"),#.binaryTarget(name: "breez_sdkFFI", url: "https://github.com/breez/breez-sdk-swift/releases/download/${{ inputs.package-version }}/breez_sdkFFI.xcframework.zip", checksum: "${{ env.XCF_CHECKSUM }}"),#;/.testTarget(name: "BreezSDKTests", dependencies: \["BreezSDK"\]),/d' Package.swift > ../../../../breez-sdk-swift/Package.swift + # Update language bindings + cp -r Sources ../../../../breez-sdk-swift + + - name: Update cocoapods definitions + working-directory: breez-sdk-swift + run: | + sed -i '' 's#^.\{2\}spec.version.*$# spec.version = "${{ inputs.package-version }}"#' breez_sdkFFI.podspec + sed -i '' 's#^.\{2\}spec.version.*$# spec.version = "${{ inputs.package-version }}"#' BreezSDK.podspec + + - name: Tag swift package + working-directory: breez-sdk-swift + if: ${{ inputs.publish }} + run: | + git add Package.swift + git add Sources + git add breez_sdkFFI.podspec + git add BreezSDK.podspec + git commit -m "Update Breez SDK Swift bindings to version ${{ inputs.package-version }}" + git push + git tag ${{ inputs.package-version }} -m "${{ inputs.package-version }}" + git push --tags + + - name: Release and attach XCFramework binary artifact + if: ${{ inputs.publish }} + uses: ncipollo/release-action@v1 + with: + repo: breez/breez-sdk-swift + tag: ${{ inputs.package-version }} + token: ${{ secrets.GITHUB_TOKEN_BREEZ_SDK_SWIFT }} + name: ${{ inputs.package-version }} + artifacts: "breez-sdk/libs/sdk-bindings/bindings-swift/breez_sdkFFI.xcframework.zip" + prerelease: true + + - name: Push update to Cocoapods trunk + working-directory: breez-sdk-swift + if: ${{ inputs.publish }} + env: + COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} + run: | + pod trunk push breez_sdkFFI.podspec --allow-warnings + pod trunk push BreezSDK.podspec --allow-warnings --synchronous From e00a7334bfa747147b921b687145b570dbbc8d87 Mon Sep 17 00:00:00 2001 From: cnixbtc <111755602+cnixbtc@users.noreply.github.com> Date: Mon, 8 Jul 2024 16:42:59 +0200 Subject: [PATCH 03/15] If swift is run, run react navtive and flutter after swift --- .github/workflows/publish-all-platforms.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-all-platforms.yml b/.github/workflows/publish-all-platforms.yml index 18f945a87..99d421124 100644 --- a/.github/workflows/publish-all-platforms.yml +++ b/.github/workflows/publish-all-platforms.yml @@ -250,7 +250,8 @@ jobs: needs: - setup - build-language-bindings - if: ${{ needs.setup.outputs.flutter == 'true' }} + - publish-swift + if: always() && !failure() && !cancelled() && ${{ needs.setup.outputs.flutter == 'true' }} uses: ./.github/workflows/publish-flutter.yml with: repository: ${{ needs.setup.outputs.repository }} @@ -265,7 +266,8 @@ jobs: publish-react-native: needs: - setup - if: ${{ needs.setup.outputs.react-native == 'true' }} + - publish-swift + if: always() && !failure() && !cancelled() && ${{ needs.setup.outputs.react-native == 'true' }} uses: ./.github/workflows/publish-react-native.yml with: repository: ${{ needs.setup.outputs.repository }} From 754ff40e904432c2176b39a65d2022dd1dea89f3 Mon Sep 17 00:00:00 2001 From: cnixbtc <111755602+cnixbtc@users.noreply.github.com> Date: Fri, 12 Jul 2024 19:20:38 +0200 Subject: [PATCH 04/15] Run flutter and RN after swift --- .github/workflows/publish-all-platforms.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-all-platforms.yml b/.github/workflows/publish-all-platforms.yml index 99d421124..e03c216a4 100644 --- a/.github/workflows/publish-all-platforms.yml +++ b/.github/workflows/publish-all-platforms.yml @@ -135,7 +135,7 @@ jobs: use-dummy-binaries: ${{ needs.setup.outputs.use-dummy-binaries == 'true' }} build-bindings-darwin: needs: setup - if: ${{ needs.setup.outputs.bindings-darwin == 'true' }} + if: always() && !failure() && !cancelled() && ${{ needs.setup.outputs.bindings-darwin == 'true' }} uses: ./.github/workflows/build-bindings-darwin.yml with: repository: ${{ needs.setup.outputs.repository }} @@ -159,7 +159,7 @@ jobs: use-dummy-binaries: ${{ needs.setup.outputs.use-dummy-binaries == 'true' }} build-bindings-ios: needs: setup - if: ${{ needs.setup.outputs.bindings-ios == 'true' }} + if: always() && !failure() && !cancelled() && ${{ needs.setup.outputs.bindings-ios == 'true' }} uses: ./.github/workflows/build-bindings-ios.yml with: repository: ${{ needs.setup.outputs.repository }} @@ -251,6 +251,10 @@ jobs: - setup - build-language-bindings - publish-swift + # The flutter package depends on the swift package to be available at runtime. + # To make sure this is will be the case, we run the publishing job only if: + # a) its dependencies (mainly publish-swift) succeeded + # b) one of its dependencies, mainly publish-swift, was explicitly skipped (but didn't fail or get cancelled) if: always() && !failure() && !cancelled() && ${{ needs.setup.outputs.flutter == 'true' }} uses: ./.github/workflows/publish-flutter.yml with: @@ -267,6 +271,10 @@ jobs: needs: - setup - publish-swift + # The react native package depends on the swift cocoapod to be available at runtime. + # To make sure this is will be the case, we run the publishing job only if: + # a) its dependencies (mainly publish-swift) succeeded + # b) one of its dependencies, mainly publish-swift, was explicitly skipped (but didn't fail or get cancelled) if: always() && !failure() && !cancelled() && ${{ needs.setup.outputs.react-native == 'true' }} uses: ./.github/workflows/publish-react-native.yml with: @@ -300,7 +308,7 @@ jobs: - build-bindings-darwin - build-bindings-ios - build-language-bindings - if: ${{ needs.setup.outputs.spm-cocoapods == 'true' }} + if: always() && !failure() && !cancelled() && ${{ needs.setup.outputs.spm-cocoapods == 'true' }} uses: ./.github/workflows/publish-swift.yml with: repository: ${{ needs.setup.outputs.repository }} From 49285656bebc8cdb9987eb2cefe06db39856f83b Mon Sep 17 00:00:00 2001 From: cnixbtc <111755602+cnixbtc@users.noreply.github.com> Date: Sun, 14 Jul 2024 13:14:02 +0200 Subject: [PATCH 05/15] Do some debug runs --- .github/workflows/publish-all-platforms.yml | 76 ++++++++++++++------- 1 file changed, 51 insertions(+), 25 deletions(-) diff --git a/.github/workflows/publish-all-platforms.yml b/.github/workflows/publish-all-platforms.yml index e03c216a4..1ef9129cd 100644 --- a/.github/workflows/publish-all-platforms.yml +++ b/.github/workflows/publish-all-platforms.yml @@ -135,7 +135,7 @@ jobs: use-dummy-binaries: ${{ needs.setup.outputs.use-dummy-binaries == 'true' }} build-bindings-darwin: needs: setup - if: always() && !failure() && !cancelled() && ${{ needs.setup.outputs.bindings-darwin == 'true' }} + if: ${{ needs.setup.outputs.bindings-darwin == 'true' }} uses: ./.github/workflows/build-bindings-darwin.yml with: repository: ${{ needs.setup.outputs.repository }} @@ -159,7 +159,7 @@ jobs: use-dummy-binaries: ${{ needs.setup.outputs.use-dummy-binaries == 'true' }} build-bindings-ios: needs: setup - if: always() && !failure() && !cancelled() && ${{ needs.setup.outputs.bindings-ios == 'true' }} + if: ${{ needs.setup.outputs.bindings-ios == 'true' }} uses: ./.github/workflows/build-bindings-ios.yml with: repository: ${{ needs.setup.outputs.repository }} @@ -251,11 +251,9 @@ jobs: - setup - build-language-bindings - publish-swift - # The flutter package depends on the swift package to be available at runtime. - # To make sure this is will be the case, we run the publishing job only if: - # a) its dependencies (mainly publish-swift) succeeded - # b) one of its dependencies, mainly publish-swift, was explicitly skipped (but didn't fail or get cancelled) - if: always() && !failure() && !cancelled() && ${{ needs.setup.outputs.flutter == 'true' }} + - publish-maven + # The flutter package depends on the swift and android packages to be available at runtime. + if: ${{ needs.setup.outputs.flutter == 'true' }} uses: ./.github/workflows/publish-flutter.yml with: repository: ${{ needs.setup.outputs.repository }} @@ -265,17 +263,13 @@ jobs: secrets: REPO_SSH_KEY: ${{ secrets.REPO_SSH_KEY }} - # react native version x.y.z will at runtime require - # ios and android packages x.y.z being published already. publish-react-native: needs: - setup - publish-swift - # The react native package depends on the swift cocoapod to be available at runtime. - # To make sure this is will be the case, we run the publishing job only if: - # a) its dependencies (mainly publish-swift) succeeded - # b) one of its dependencies, mainly publish-swift, was explicitly skipped (but didn't fail or get cancelled) - if: always() && !failure() && !cancelled() && ${{ needs.setup.outputs.react-native == 'true' }} + - publish-maven + # The react native package depends on the swift and android packages to be available at runtime. + if: ${{ needs.setup.outputs.react-native == 'true' }} uses: ./.github/workflows/publish-react-native.yml with: repository: ${{ needs.setup.outputs.repository }} @@ -308,14 +302,46 @@ jobs: - build-bindings-darwin - build-bindings-ios - build-language-bindings - if: always() && !failure() && !cancelled() && ${{ needs.setup.outputs.spm-cocoapods == 'true' }} - uses: ./.github/workflows/publish-swift.yml - with: - repository: ${{ needs.setup.outputs.repository }} - ref: ${{ needs.setup.outputs.ref }} - package-version: ${{ needs.setup.outputs.swift-package-version }} - publish: ${{ needs.setup.outputs.publish == 'true' }} - secrets: - REPO_SSH_KEY: ${{ secrets.REPO_SSH_KEY }} - GITHUB_TOKEN_BREEZ_SDK_SWIFT: ${{ secrets.GITHUB_TOKEN_BREEZ_SDK_SWIFT }} # todo: create token - COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} # todo: create token + if: ${{ needs.setup.outputs.spm-cocoapods == 'true' }} + runs-on: ubuntu-latest + steps: + - name: publish swift (failing) + run: exit 1 + # uses: ./.github/workflows/publish-swift.yml + # with: + # repository: ${{ needs.setup.outputs.repository }} + # ref: ${{ needs.setup.outputs.ref }} + # package-version: ${{ needs.setup.outputs.swift-package-version }} + # publish: ${{ needs.setup.outputs.publish == 'true' }} + # secrets: + # REPO_SSH_KEY: ${{ secrets.REPO_SSH_KEY }} + # GITHUB_TOKEN_BREEZ_SDK_SWIFT: ${{ secrets.GITHUB_TOKEN_BREEZ_SDK_SWIFT }} # todo: create token + # COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} # todo: create token + + debug-print: + needs: + - setup + - publish-swift + - publish-maven + runs-on: ubuntu-latest + if: ${{ always() && !failure() && !cancelled() }} + steps: + - name: check needs results + run: | + echo ${{ needs.setup.outputs.spm-cocoapods }} + echo ${{ needs.setup.outputs.maven }} + echo ${{ needs.publish-swift.result }} + echo ${{ needs.publish-maven.result }} + + debug-publish: + needs: + - setup + - publish-swift + - publish-maven + if: ${{ true && always() && !failure() && !cancelled() }} + runs-on: ubuntu-latest + steps: + - name: check needs results + run: | + echo ${{ needs.publish-swift.result }} + echo ${{ needs.publish-maven.result }} From 8ca7d8cbf43b7b17660b1d80127fe1f2c90d1ab1 Mon Sep 17 00:00:00 2001 From: cnixbtc <111755602+cnixbtc@users.noreply.github.com> Date: Sun, 14 Jul 2024 17:53:09 +0200 Subject: [PATCH 06/15] Remove debug code --- .github/workflows/publish-all-platforms.yml | 60 ++++++--------------- 1 file changed, 16 insertions(+), 44 deletions(-) diff --git a/.github/workflows/publish-all-platforms.yml b/.github/workflows/publish-all-platforms.yml index 1ef9129cd..2d252bf64 100644 --- a/.github/workflows/publish-all-platforms.yml +++ b/.github/workflows/publish-all-platforms.yml @@ -253,7 +253,9 @@ jobs: - publish-swift - publish-maven # The flutter package depends on the swift and android packages to be available at runtime. - if: ${{ needs.setup.outputs.flutter == 'true' }} + # Therefore, if swift and/or android publishing is turned on, we will run this job only if swift and/or android is successfully published. + # If however swift and/or android is skipped, we will run this job nonetheless. + if: ${{ needs.setup.outputs.flutter == 'true' && always() && !failure() && !cancelled() }} uses: ./.github/workflows/publish-flutter.yml with: repository: ${{ needs.setup.outputs.repository }} @@ -269,7 +271,9 @@ jobs: - publish-swift - publish-maven # The react native package depends on the swift and android packages to be available at runtime. - if: ${{ needs.setup.outputs.react-native == 'true' }} + # Therefore, if swift and/or android publishing is turned on, we will run this job only if swift and/or android is successfully published. + # If however swift and/or android is skipped, we will run this job nonetheless. + if: ${{ needs.setup.outputs.react-native == 'true' && always() && !failure() && !cancelled() }} uses: ./.github/workflows/publish-react-native.yml with: repository: ${{ needs.setup.outputs.repository }} @@ -303,45 +307,13 @@ jobs: - build-bindings-ios - build-language-bindings if: ${{ needs.setup.outputs.spm-cocoapods == 'true' }} - runs-on: ubuntu-latest - steps: - - name: publish swift (failing) - run: exit 1 - # uses: ./.github/workflows/publish-swift.yml - # with: - # repository: ${{ needs.setup.outputs.repository }} - # ref: ${{ needs.setup.outputs.ref }} - # package-version: ${{ needs.setup.outputs.swift-package-version }} - # publish: ${{ needs.setup.outputs.publish == 'true' }} - # secrets: - # REPO_SSH_KEY: ${{ secrets.REPO_SSH_KEY }} - # GITHUB_TOKEN_BREEZ_SDK_SWIFT: ${{ secrets.GITHUB_TOKEN_BREEZ_SDK_SWIFT }} # todo: create token - # COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} # todo: create token - - debug-print: - needs: - - setup - - publish-swift - - publish-maven - runs-on: ubuntu-latest - if: ${{ always() && !failure() && !cancelled() }} - steps: - - name: check needs results - run: | - echo ${{ needs.setup.outputs.spm-cocoapods }} - echo ${{ needs.setup.outputs.maven }} - echo ${{ needs.publish-swift.result }} - echo ${{ needs.publish-maven.result }} - - debug-publish: - needs: - - setup - - publish-swift - - publish-maven - if: ${{ true && always() && !failure() && !cancelled() }} - runs-on: ubuntu-latest - steps: - - name: check needs results - run: | - echo ${{ needs.publish-swift.result }} - echo ${{ needs.publish-maven.result }} + uses: ./.github/workflows/publish-swift.yml + with: + repository: ${{ needs.setup.outputs.repository }} + ref: ${{ needs.setup.outputs.ref }} + package-version: ${{ needs.setup.outputs.swift-package-version }} + publish: ${{ needs.setup.outputs.publish == 'true' }} + secrets: + REPO_SSH_KEY: ${{ secrets.REPO_SSH_KEY }} + GITHUB_TOKEN_BREEZ_SDK_SWIFT: ${{ secrets.GITHUB_TOKEN_BREEZ_SDK_SWIFT }} # todo: create token + COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} # todo: create token From 7ddfd23379edfc31507c221a4804f14dd7d43ef8 Mon Sep 17 00:00:00 2001 From: cnixbtc <111755602+cnixbtc@users.noreply.github.com> Date: Sun, 14 Jul 2024 19:23:12 +0200 Subject: [PATCH 07/15] Fix asset download for ios universal bindings --- .github/workflows/build-bindings-ios.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-bindings-ios.yml b/.github/workflows/build-bindings-ios.yml index 5011446e0..90c086dd9 100644 --- a/.github/workflows/build-bindings-ios.yml +++ b/.github/workflows/build-bindings-ios.yml @@ -77,17 +77,17 @@ jobs: needs: build name: build ios-universal steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: sdk-bindings-aarch64-apple-ios path: aarch64-apple-ios - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: sdk-bindings-x86_64-apple-ios path: x86_64-apple-ios - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: name: sdk-bindings-aarch64-apple-ios-sim path: aarch64-apple-ios-sim @@ -102,14 +102,14 @@ jobs: lipo -create -output ios-universal-sim/libbreez_sdk_bindings.a aarch64-apple-ios-sim/release/libbreez_sdk_bindings.a x86_64-apple-ios/release/libbreez_sdk_bindings.a - name: Archive release - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: sdk-bindings-ios-universal path: | ios-universal/libbreez_sdk_bindings.a - name: Archive release - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: sdk-bindings-ios-universal-sim path: | From d927bee524d0b2c78aeb3366f7f1585f0eaaa6c4 Mon Sep 17 00:00:00 2001 From: cnixbtc <111755602+cnixbtc@users.noreply.github.com> Date: Sun, 14 Jul 2024 19:34:51 +0200 Subject: [PATCH 08/15] Fix lipo command --- .github/workflows/build-bindings-ios.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-bindings-ios.yml b/.github/workflows/build-bindings-ios.yml index 90c086dd9..ef8bd20ab 100644 --- a/.github/workflows/build-bindings-ios.yml +++ b/.github/workflows/build-bindings-ios.yml @@ -97,9 +97,9 @@ jobs: mkdir -p ios-universal mkdir -p ios-universal-sim # build universal lib for arm device and x86 sim - lipo -create -output ios-universal/libbreez_sdk_bindings.a aarch64-apple-ios/release/libbreez_sdk_bindings.a x86_64-apple-ios/release/libbreez_sdk_bindings.a + lipo -create -output ios-universal/libbreez_sdk_bindings.a aarch64-apple-ios/libbreez_sdk_bindings.a x86_64-apple-ios/libbreez_sdk_bindings.a # build universal lib for arm sim and x86 sim - lipo -create -output ios-universal-sim/libbreez_sdk_bindings.a aarch64-apple-ios-sim/release/libbreez_sdk_bindings.a x86_64-apple-ios/release/libbreez_sdk_bindings.a + lipo -create -output ios-universal-sim/libbreez_sdk_bindings.a aarch64-apple-ios-sim/libbreez_sdk_bindings.a x86_64-apple-ios/libbreez_sdk_bindings.a - name: Archive release uses: actions/upload-artifact@v4 From d54743a8ca958700206b8349d550d87e5cd3bb3e Mon Sep 17 00:00:00 2001 From: cnixbtc <111755602+cnixbtc@users.noreply.github.com> Date: Sat, 31 Aug 2024 11:33:19 +0200 Subject: [PATCH 09/15] Archive xcframework --- .github/workflows/publish-swift.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/publish-swift.yml b/.github/workflows/publish-swift.yml index ceed7fcc1..dded2d8a6 100644 --- a/.github/workflows/publish-swift.yml +++ b/.github/workflows/publish-swift.yml @@ -86,6 +86,12 @@ jobs: zip -9 -r breez_sdkFFI.xcframework.zip breez_sdkFFI.xcframework echo "XCF_CHECKSUM=`swift package compute-checksum breez_sdkFFI.xcframework.zip`" >> $GITHUB_ENV + - name: Archive xcframework + uses: actions/upload-artifact@v4 + with: + name: breez_sdkFFI-${{ inputs.package-version || intouts.ref }}.xcframework + path: breez-sdk/libs/sdk-bindings/bindings-swift/breez_sdkFFI.xcframework + - name: Update swift package working-directory: breez-sdk/libs/sdk-bindings/bindings-swift run: | From 3aed24bc9d770dbf57f660cfcc7805e043cc5447 Mon Sep 17 00:00:00 2001 From: cnixbtc <111755602+cnixbtc@users.noreply.github.com> Date: Sat, 31 Aug 2024 11:35:15 +0200 Subject: [PATCH 10/15] Rename swift release token --- .github/workflows/publish-swift.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-swift.yml b/.github/workflows/publish-swift.yml index dded2d8a6..b211e49a5 100644 --- a/.github/workflows/publish-swift.yml +++ b/.github/workflows/publish-swift.yml @@ -125,7 +125,7 @@ jobs: with: repo: breez/breez-sdk-swift tag: ${{ inputs.package-version }} - token: ${{ secrets.GITHUB_TOKEN_BREEZ_SDK_SWIFT }} + token: ${{ secrets.SWIFT_RELEASE_TOKEN }} name: ${{ inputs.package-version }} artifacts: "breez-sdk/libs/sdk-bindings/bindings-swift/breez_sdkFFI.xcframework.zip" prerelease: true From ac21299cf92a08ab266c2c913fe088848f284103 Mon Sep 17 00:00:00 2001 From: cnixbtc <111755602+cnixbtc@users.noreply.github.com> Date: Tue, 3 Sep 2024 19:33:10 +0200 Subject: [PATCH 11/15] Fix typo --- .github/workflows/publish-swift.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-swift.yml b/.github/workflows/publish-swift.yml index b211e49a5..54e362db8 100644 --- a/.github/workflows/publish-swift.yml +++ b/.github/workflows/publish-swift.yml @@ -89,7 +89,7 @@ jobs: - name: Archive xcframework uses: actions/upload-artifact@v4 with: - name: breez_sdkFFI-${{ inputs.package-version || intouts.ref }}.xcframework + name: breez_sdkFFI-${{ inputs.package-version || intputs.ref }}.xcframework path: breez-sdk/libs/sdk-bindings/bindings-swift/breez_sdkFFI.xcframework - name: Update swift package From b87ca10ad78643666706b8740e4e82de1aa760b5 Mon Sep 17 00:00:00 2001 From: cnixbtc <111755602+cnixbtc@users.noreply.github.com> Date: Tue, 3 Sep 2024 19:36:23 +0200 Subject: [PATCH 12/15] Align release action with what is used in liquid CI --- .github/workflows/publish-swift.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-swift.yml b/.github/workflows/publish-swift.yml index 54e362db8..957204a5c 100644 --- a/.github/workflows/publish-swift.yml +++ b/.github/workflows/publish-swift.yml @@ -121,13 +121,14 @@ jobs: - name: Release and attach XCFramework binary artifact if: ${{ inputs.publish }} - uses: ncipollo/release-action@v1 + uses: softprops/action-gh-release@v2 with: - repo: breez/breez-sdk-swift - tag: ${{ inputs.package-version }} + repository: breez/breez-sdk-swift + files: | + breez-sdk/libs/sdk-bindings/bindings-swift/breez_sdkFFI.xcframework.zip + tag_name: ${{ inputs.package-version }} + generate_release_notes: false token: ${{ secrets.SWIFT_RELEASE_TOKEN }} - name: ${{ inputs.package-version }} - artifacts: "breez-sdk/libs/sdk-bindings/bindings-swift/breez_sdkFFI.xcframework.zip" prerelease: true - name: Push update to Cocoapods trunk From ad5d662ad7580ef29448caa9990299dd1ebeb9ea Mon Sep 17 00:00:00 2001 From: Daniel <111755602+cnixbtc@users.noreply.github.com> Date: Tue, 3 Sep 2024 21:01:46 +0200 Subject: [PATCH 13/15] Update publish-swift.yml Co-authored-by: Jesse de Wit --- .github/workflows/publish-swift.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-swift.yml b/.github/workflows/publish-swift.yml index 957204a5c..411a76fcb 100644 --- a/.github/workflows/publish-swift.yml +++ b/.github/workflows/publish-swift.yml @@ -89,7 +89,7 @@ jobs: - name: Archive xcframework uses: actions/upload-artifact@v4 with: - name: breez_sdkFFI-${{ inputs.package-version || intputs.ref }}.xcframework + name: breez_sdkFFI-${{ inputs.package-version || inputs.ref }}.xcframework path: breez-sdk/libs/sdk-bindings/bindings-swift/breez_sdkFFI.xcframework - name: Update swift package From ccba7b883a3368f1a8fd86e0bc71713fddcbb60f Mon Sep 17 00:00:00 2001 From: Daniel <111755602+cnixbtc@users.noreply.github.com> Date: Wed, 4 Sep 2024 18:43:43 +0200 Subject: [PATCH 14/15] Update publish-swift.yml Co-authored-by: Ross Savage <551697+dangeross@users.noreply.github.com> --- .github/workflows/publish-swift.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-swift.yml b/.github/workflows/publish-swift.yml index 411a76fcb..20d748061 100644 --- a/.github/workflows/publish-swift.yml +++ b/.github/workflows/publish-swift.yml @@ -23,7 +23,7 @@ on: REPO_SSH_KEY: description: 'ssh key to commit to the breez-sdk-swift repository' required: true - GITHUB_TOKEN_BREEZ_SDK_SWIFT: + SWIFT_RELEASE_TOKEN: description: 'token to create a release to the breez-sdk-swift repository' required: true COCOAPODS_TRUNK_TOKEN: From 0715a428a2a79518d70ca3225c09f1a038f95506 Mon Sep 17 00:00:00 2001 From: Daniel <111755602+cnixbtc@users.noreply.github.com> Date: Wed, 4 Sep 2024 18:43:50 +0200 Subject: [PATCH 15/15] Update publish-all-platforms.yml Co-authored-by: Ross Savage <551697+dangeross@users.noreply.github.com> --- .github/workflows/publish-all-platforms.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-all-platforms.yml b/.github/workflows/publish-all-platforms.yml index 2d252bf64..ca8cc3699 100644 --- a/.github/workflows/publish-all-platforms.yml +++ b/.github/workflows/publish-all-platforms.yml @@ -315,5 +315,5 @@ jobs: publish: ${{ needs.setup.outputs.publish == 'true' }} secrets: REPO_SSH_KEY: ${{ secrets.REPO_SSH_KEY }} - GITHUB_TOKEN_BREEZ_SDK_SWIFT: ${{ secrets.GITHUB_TOKEN_BREEZ_SDK_SWIFT }} # todo: create token - COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }} # todo: create token + SWIFT_RELEASE_TOKEN: ${{ secrets. SWIFT_RELEASE_TOKEN }} + COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}