diff --git a/.github/workflows/publish-all-platforms.yml b/.github/workflows/publish-all-platforms.yml index 2b448ae13..e5527a4e9 100644 --- a/.github/workflows/publish-all-platforms.yml +++ b/.github/workflows/publish-all-platforms.yml @@ -26,6 +26,10 @@ on: description: 'version for the kotlin multiplatform package (MAJOR.MINOR.BUILD)' required: false type: string + flutter-package-version: + description: 'version for the flutter package (MAJOR.MINOR.BUILD) (no v prefix)' + required: false + type: string react-native-package-version: description: 'version for the react native package (MAJOR.MINOR.BUILD)' required: false @@ -49,7 +53,7 @@ jobs: windows: ${{ !!inputs.csharp-package-version || !!inputs.golang-package-version }} darwin: ${{ !!inputs.csharp-package-version || !!inputs.golang-package-version }} linux: ${{ !!inputs.csharp-package-version || !!inputs.golang-package-version }} - android: ${{ !!inputs.kotlin-mpp-package-version || !!inputs.maven-package-version || !!inputs.golang-package-version }} + android: ${{ !!inputs.kotlin-mpp-package-version || !!inputs.maven-package-version || !!inputs.flutter-package-version }} || !!inputs.golang-package-version }} ios: ${{ !!inputs.kotlin-mpp-package-version || !!inputs.maven-package-version }} kotlin: ${{ !!inputs.kotlin-mpp-package-version || !!inputs.maven-package-version }} swift: false @@ -58,6 +62,7 @@ jobs: golang: ${{ !!inputs.golang-package-version }} maven: ${{ !!inputs.maven-package-version }} kotlin-mpp: ${{ !!inputs.kotlin-mpp-package-version }} + flutter: ${{ !!inputs.flutter-package-version }} react-native: ${{ !!inputs.react-native-package-version }} ref: ${{ inputs.ref || github.sha }} csharp-package-version: ${{ inputs.csharp-package-version || '0.0.2' }} @@ -65,6 +70,7 @@ jobs: golang-package-version: ${{ inputs.golang-package-version || '0.0.2' }} maven-package-version: ${{ inputs.maven-package-version || '0.0.2' }} kotlin-mpp-package-version: ${{ inputs.kotlin-mpp-package-version || '0.0.2' }} + flutter-package-version: ${{ inputs.flutter-package-version || '0.0.2' }} react-native-package-version: ${{ inputs.react-native-package-version || '0.0.2' }} publish: ${{ inputs.publish }} steps: @@ -175,6 +181,19 @@ jobs: secrets: BREEZ_MVN_USERNAME: ${{ secrets.BREEZ_MVN_USERNAME }} BREEZ_MVN_PASSWORD: ${{ secrets.BREEZ_MVN_PASSWORD }} + + publish-flutter: + needs: + - setup + - build-android + if: ${{ needs.setup.outputs.flutter == 'true' }} + uses: ./.github/workflows/publish-flutter.yml + with: + ref: ${{ needs.setup.outputs.ref }} + package-version: ${{ needs.setup.outputs.flutter-package-version }} + publish: ${{ needs.setup.outputs.publish == 'true' }} + 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. diff --git a/.github/workflows/publish-flutter.yml b/.github/workflows/publish-flutter.yml new file mode 100644 index 000000000..2d751fae0 --- /dev/null +++ b/.github/workflows/publish-flutter.yml @@ -0,0 +1,74 @@ +name: Publish Flutter Package +on: + workflow_call: + inputs: + ref: + description: 'commit/tag/branch reference' + required: true + type: string + package-version: + description: 'version for the flutter package (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-flutter repository' + required: true + +jobs: + build-tag-release: + runs-on: ubuntu-latest + steps: + - name: Checkout breez-sdk-flutter repo + uses: actions/checkout@v3 + with: + repository: breez/breez-sdk-flutter + ssh-key: ${{ secrets.REPO_SSH_KEY }} + fetch-depth: 0 + path: flutter + + - name: Checkout breez-sdk repo + uses: actions/checkout@v3 + with: + ref: ${{ inputs.ref || github.sha }} + path: breez-sdk + + - uses: actions/download-artifact@v3 + with: + name: android-jniLibs + path: flutter/sdk-flutter/android/src/main + + - uses: subosito/flutter-action@v2 + with: + flutter-version: '3.7.12' + channel: 'stable' + + - name: Copy packge files + working-directory: flutter + run: | + rm -f ../breez-sdk/libs/sdk-flutter/ios/breez_sdk.podspec.dev + mv ../breez-sdk/libs/sdk-flutter/ios/breez_sdk.podspec.production ../breez-sdk/libs/sdk-flutter/ios/breez_sdk.podspec + cp -r ../breez-sdk/libs/sdk-flutter/ios . + cp -r ../breez-sdk/libs/sdk-flutter/android . + cp -r ../breez-sdk/libs/sdk-flutter/lib . + cp ../breez-sdk/libs/sdk-flutter/pubspec.yaml . + cp ../breez-sdk/libs/sdk-flutter/pubspec.lock . + + - name: Tag the Flutter package + working-directory: flutter + if: ${{ inputs.publish }} + run: | + git config --global user.email github-actions@github.com + git config --global user.name github-actions + flutter pub global activate pubspec_version + pubver set ${{ inputs.package-version }} + git add . + git commit -m "Update Breez SDK Flutter package to version v${{ inputs.package-version }}" + git push + git tag v${{ inputs.package-version }} -m "v${{ inputs.package-version }}" + git push --tags