Files
breez-sdk-liquid/.github/workflows/publish-flutter.yml
Erdem Yerebasmaz 3e38e5963a Downgrade Flutter to 3.22.3 (#438)
* Downgrade Flutter to 3.22.3

Downgrade Flutter to 3.22.3 until resource linking issue is resolved on Android release builds with 3.24

* Update pubspec.lock
2024-08-08 16:47:21 +03:00

128 lines
4.7 KiB
YAML

name: Publish Flutter Package
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 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-liquid-flutter repository'
required: true
SWIFT_RELEASE_TOKEN:
description: 'github token to release to the breez-sdk-liquid-flutter repository'
required: true
jobs:
build-tag-release:
runs-on: ubuntu-latest
steps:
- name: Checkout breez-sdk-liquid-flutter repo
uses: actions/checkout@v4
with:
repository: breez/breez-sdk-liquid-flutter
ssh-key: ${{ secrets.REPO_SSH_KEY }}
fetch-depth: 0
path: dist
- name: Checkout breez-sdk-liquid repo
uses: actions/checkout@v4
with:
repository: ${{ inputs.repository || github.repository }}
ref: ${{ inputs.ref || github.sha }}
path: build
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: 3.22.3 # Pinned until resource linking issues on Android is resolved with 3.24
- name: Copy package files
working-directory: dist
run: |
rm -rf android
rm -rf ios
rm -rf lib
cp -r ../build/packages/flutter/android .
cp -r ../build/packages/flutter/ios .
mv ios/flutter_breez_liquid.podspec.production ios/flutter_breez_liquid.podspec
cp -r ../build/packages/flutter/lib .
cp -r ../build/lib/bindings/langs/flutter/breez_sdk_liquid/include/breez_sdk_liquid.h ios/Classes
cp ../build/packages/flutter/analysis_options.yaml .
cp ../build/packages/flutter/pubspec.yaml .
cp ../build/packages/flutter/pubspec_overrides.yaml .
- name: Copy docs
working-directory: dist
run: |
cp ../build/packages/flutter/CHANGELOG.md . || true
cp ../build/packages/flutter/LICENSE . || true
cp ../build/packages/flutter/README.md . || true
- uses: actions/download-artifact@v4
with:
name: bindings-flutter
path: bindings/
- name: Set package version
working-directory: dist
run: |
sed -i.bak -e 's/version:.*/version: ${{ inputs.package-version }}/' pubspec.yaml
sed -i.bak -e 's/path:.*/git:\n url: git@github.com:breez\/breez-sdk-liquid-dart.git\n ref: ${{ inputs.package-version }}/' pubspec_overrides.yaml
sed -i.bak -e "s/^version .*/version '${{ inputs.package-version }}'/" android/build.gradle
sed -i.bak -e 's/set(TagName.*/set(TagName "v${{ inputs.package-version }}")/' android/CMakeLists.txt
sed -i.bak -e "s/^version = .*/version = '${{ inputs.package-version }}'/" ios/flutter_breez_liquid.podspec
rm pubspec.yaml.bak
rm pubspec_overrides.yaml.bak
rm android/build.gradle.bak
rm android/CMakeLists.txt.bak
rm ios/flutter_breez_liquid.podspec.bak
- name: Archive flutter release
uses: actions/upload-artifact@v4
with:
name: breez-sdk-liquid-flutter-${{ inputs.package-version || github.sha }}
path: |
dist/*
!dist/.git
- name: Tag the Flutter package
working-directory: dist
if: ${{ inputs.publish }}
run: |
git config --global user.email github-actions@github.com
git config --global user.name github-actions
git add .
git commit -m "Update Flutter package to version v${{ inputs.package-version }}"
git push
git tag v${{ inputs.package-version }} -m "v${{ inputs.package-version }}"
git push --tags
- name: Release and attach binary artifacts
if: ${{ inputs.publish }}
uses: softprops/action-gh-release@v2
with:
repository: breez/breez-sdk-liquid-flutter
files: |
bindings/android.tar.gz
bindings/breez_sdk_liquid.xcframework.zip
tag_name: v${{ inputs.package-version || '0.0.1' }}
generate_release_notes: false
token: ${{ secrets.SWIFT_RELEASE_TOKEN }}
prerelease: true