-
Notifications
You must be signed in to change notification settings - Fork 46
104 lines (95 loc) · 3.47 KB
/
publish-flutter.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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-flutter repository'
required: true
jobs:
build-tag-release:
runs-on: ubuntu-latest
steps:
- name: Checkout breez-sdk-flutter repo
uses: actions/checkout@v4
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@v4
with:
repository: ${{ inputs.repository || github.repository }}
ref: ${{ inputs.ref || github.sha }}
path: breez-sdk
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: 3.22.3
- name: Copy package files
working-directory: flutter
run: |
rm -r ios
rm -r android
rm -r lib
cp -r ../breez-sdk/libs/sdk-flutter/ios .
mv ios/breez_sdk.podspec.production ios/breez_sdk.podspec
cp -r ../breez-sdk/libs/sdk-flutter/android .
mv android/build.gradle.production android/build.gradle
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: Copy docs
working-directory: flutter
run: |
cp ../breez-sdk/libs/sdk-flutter/README.pub.md README.md || true
cp ../breez-sdk/libs/sdk-flutter/CHANGELOG.md . || true
- uses: actions/download-artifact@v4
with:
name: bindings-swift
path: flutter/ios/bindings-swift/Sources/BreezSDK/
- name: Set package version
working-directory: flutter
run: |
sed -i.bak -e 's/version:.*/version: ${{ inputs.package-version }}/' pubspec.yaml
sed -i.bak -e "s/^version .*/version '${{ inputs.package-version }}'/" android/build.gradle
sed -i.bak -e "s/^tag_version = .*/tag_version = '${{ inputs.package-version }}'/" ios/breez_sdk.podspec
rm pubspec.yaml.bak
rm android/build.gradle.bak
rm ios/breez_sdk.podspec.bak
- name: Archive flutter release
uses: actions/upload-artifact@v4
with:
name: breez-sdk-flutter-${{ inputs.package-version || github.sha }}
path: |
flutter/*
!flutter/.git
- 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
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