Skip to content

Commit

Permalink
Merge pull request #413 from breez/flutter-publish
Browse files Browse the repository at this point in the history
publish flutter CI
  • Loading branch information
roeierez authored Aug 31, 2023
2 parents 2936484 + bb22527 commit 178c30e
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 1 deletion.
21 changes: 20 additions & 1 deletion .github/workflows/publish-all-platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -58,13 +62,15 @@ 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' }}
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' }}
react-native-package-version: ${{ inputs.react-native-package-version || '0.0.2' }}
publish: ${{ inputs.publish }}
steps:
Expand Down Expand Up @@ -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.
Expand Down
74 changes: 74 additions & 0 deletions .github/workflows/publish-flutter.yml
Original file line number Diff line number Diff line change
@@ -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 [email protected]
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

0 comments on commit 178c30e

Please sign in to comment.