-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (89 loc) · 3.37 KB
/
release.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
105
106
107
108
109
110
111
112
name: Build and Release
on:
push:
tags:
- 'v*' # Triggers on version tags like v1.0.0
workflow_dispatch: # Allows manual triggering of the workflow
jobs:
extract_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Extract version from pubspec.yaml
id: extract_version
run: |
# Extract version string from pubspec.yaml
VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //')
# Split VERSION into version name and build number
BUILD_NAME=$(echo $VERSION | cut -d "+" -f 1)
BUILD_NUMBER=$(echo $VERSION | cut -d "+" -f 2)
# Set the extracted values as environment variables
echo "BUILD_NAME=$BUILD_NAME" >> $GITHUB_ENV
echo "BUILD_NUMBER=$BUILD_NUMBER" >> $GITHUB_ENV
build_android:
runs-on: ubuntu-latest
needs: extract_version
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: 'stable'
- name: Decode keystore
run: echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 --decode > release-keystore.jks
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Build Android APK
run: |
flutter build apk --release --no-tree-shake-icons \
--build-name=${{ env.BUILD_NAME }} \
--build-number=${{ env.BUILD_NUMBER }}
- name: Build Android App Bundle
run: |
flutter build appbundle --release --no-tree-shake-icons \
--build-name=${{ env.BUILD_NAME }} \
--build-number=${{ env.BUILD_NUMBER }}
- name: Upload APK
uses: actions/upload-artifact@v3
with:
name: app-release.apk
path: build/app/outputs/flutter-apk/app-release.apk
- name: Upload AAB
uses: actions/upload-artifact@v3
with:
name: app-release.aab
path: build/app/outputs/bundle/release/app-release.aab
build_ios:
runs-on: macos-latest
needs: build_android
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: 'stable'
- name: Set up CocoaPods
run: pod install --project-directory=ios/
- name: Decode certificates and profiles
run: |
echo "${{ secrets.IOS_CERTIFICATE }}" | base64 --decode > ios_certificate.p12
echo "${{ secrets.IOS_PROFILE }}" | base64 --decode > ios_profile.mobileprovision
- name: Install Fastlane
run: gem install fastlane
- name: Build iOS App
env:
APP_STORE_CONNECT_KEY_ID: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}
APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
APP_STORE_CONNECT_PRIVATE_KEY: ${{ secrets.APP_STORE_CONNECT_PRIVATE_KEY }}
IOS_CERTIFICATE_PASSWORD: ${{ secrets.IOS_CERTIFICATE_PASSWORD }}
run: |
fastlane run unlock_keychain
flutter build ipa --release --no-tree-shake-icons \
--build-name=${{ env.BUILD_NAME }} \
--build-number=${{ env.BUILD_NUMBER }}
- name: Upload IPA
uses: actions/upload-artifact@v3
with:
name: app-release.ipa
path: build/ios/ipa/*.ipa