Repository navigation
102 lines (85 loc) · 2.75 KB
/
Copy pathmain.yaml
File metadata and controls
102 lines (85 loc) · 2.75 KB
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
name: "Build & Release"
on:
push:
branches:
- master
jobs:
build:
name: Build & Release
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Cache Java Dependencies (Gradle)
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
gradle-${{ runner.os }}-
- name: Set Up Java
uses: actions/setup-java@v3.12.0
with:
distribution: "oracle"
java-version: "17"
- name: Cache Flutter SDK
uses: actions/cache@v3
with:
path: /opt/hostedtoolcache/flutter
key: flutter-${{ runner.os }}-${{ hashFiles('**/pubspec.yaml') }}
restore-keys: |
flutter-${{ runner.os }}-
- name: Set Up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.27.1"
channel: "stable"
- name: Cache Flutter Dependencies
uses: actions/cache@v3
with:
path: ~/.pub-cache
key: flutter-${{ runner.os }}-${{ hashFiles('**/pubspec.yaml') }}
restore-keys: |
flutter-${{ runner.os }}-
- name: Install Dependencies
run: flutter pub get
- name: Build APK
run: flutter build apk --release
- name: Build IPA
run: flutter build ipa --no-codesign
- name: Compress Archive and IPAs
run: |
cd build
tar -czf ios_build.tar.gz ios
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: Releases
path: |
build/app/outputs/flutter-apk/app-release.apk
build/ios_build.tar.g
- name: Extract version from pubspec.yaml
id: extract_version
run: |
version=$(grep '^version: ' pubspec.yaml | cut -d ' ' -f 2 | tr -d '\r')
echo "VERSION=$version" >> $GITHUB_ENV
- name: Check if Tag Exists
id: check_tag
run: |
if git rev-parse "v${{ env.VERSION }}" >/dev/null 2>&1; then
echo "TAG_EXISTS=true" >> $GITHUB_ENV
else
echo "TAG_EXISTS=false" >> $GITHUB_ENV
fi
- name: Modify Tag
if: env.TAG_EXISTS
id: modify_tag
run: |
new_version="${{ env.VERSION }}-build-${{ github.run_number }}"
echo "VERSION=$new_version" >> $GITHUB_ENV
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: "build/app/outputs/flutter-apk/app-release.apk,build/ios_build.tar.gz"
tag: v${{ env.VERSION }}
token: ${{ secrets.TOKEN }}