From b8ddf349f10d073bb32140a5c6e5ae131726e07d Mon Sep 17 00:00:00 2001 From: Roei Erez Date: Wed, 30 Aug 2023 15:36:26 +0300 Subject: [PATCH 1/2] publish flutter ci --- .github/workflows/publish-all-platforms.yml | 21 +++++- .github/workflows/publish-flutter.yml | 73 +++++++++++++++++++++ 2 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/publish-flutter.yml diff --git a/.github/workflows/publish-all-platforms.yml b/.github/workflows/publish-all-platforms.yml index ecbb49b8d..91cb62778 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 publish: description: 'boolean indicating whether packages should be published. true to publish. false to build only. Default = false.' required: false @@ -45,7 +49,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 }} + android: ${{ !!inputs.kotlin-mpp-package-version || !!inputs.maven-package-version || !!inputs.flutter-package-version }} ios: ${{ !!inputs.kotlin-mpp-package-version || !!inputs.maven-package-version }} kotlin: ${{ !!inputs.kotlin-mpp-package-version || !!inputs.maven-package-version }} swift: false @@ -54,12 +58,14 @@ jobs: golang: ${{ !!inputs.golang-package-version }} maven: ${{ !!inputs.maven-package-version }} kotlin-mpp: ${{ !!inputs.kotlin-mpp-package-version }} + flutter: ${{ !!inputs.flutter-package-version }} ref: ${{ inputs.ref || github.sha }} csharp-package-version: ${{ inputs.csharp-package-version || '0.0.2' }} csharp-ref: ${{ inputs.csharp-ref || inputs.ref || github.sha }} 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' }} publish: ${{ inputs.publish }} steps: - run: echo "set output variables" @@ -168,3 +174,16 @@ 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 }} \ No newline at end of file diff --git a/.github/workflows/publish-flutter.yml b/.github/workflows/publish-flutter.yml new file mode 100644 index 000000000..1b8d7620c --- /dev/null +++ b/.github/workflows/publish-flutter.yml @@ -0,0 +1,73 @@ +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 + 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 From 32765dff31ebcc9272423a6b22d4302048fed00b Mon Sep 17 00:00:00 2001 From: Roei Erez Date: Thu, 31 Aug 2023 15:27:22 +0300 Subject: [PATCH 2/2] fix deply condition --- .github/workflows/publish-flutter.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish-flutter.yml b/.github/workflows/publish-flutter.yml index 1b8d7620c..2d751fae0 100644 --- a/.github/workflows/publish-flutter.yml +++ b/.github/workflows/publish-flutter.yml @@ -61,6 +61,7 @@ jobs: - 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