-
-
Notifications
You must be signed in to change notification settings - Fork 14
226 lines (190 loc) · 6.45 KB
/
flutter_build_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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
name: Flutter Build Release
on:
push:
branches:
- dev
tags:
- '*'
env:
FLUTTER_VERSION: '3.24.3'
IS_PRERELEASE: ${{ startsWith(github.ref, 'refs/tags/') && 'false' || 'true' }}
RELEASE_TAG: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}
jobs:
cancel:
name: Cancel Previous Runs
runs-on: ubuntu-latest
steps:
- uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
android:
needs: cancel
name: Build APK
runs-on: ubuntu-latest
env:
FLUTTER_KEY_ALIAS: ${{ secrets.FLUTTER_KEY_ALIAS }}
FLUTTER_KEY_PASSWORD: ${{ secrets.FLUTTER_KEY_PASSWORD }}
FLUTTER_STORE_PASSWORD: ${{ secrets.FLUTTER_STORE_PASSWORD }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin' # or 'zulu', depending on your preference
java-version: '17'
- name: Cache Flutter SDK and dependencies
uses: actions/cache@v2
with:
path: |
~/.pub-cache
~/.flutter
key: ${{ runner.os }}-flutter-${{ env.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.yaml') }}
restore-keys: |
${{ runner.os }}-flutter-${{ env.FLUTTER_VERSION }}-
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Decode Keystore
run: echo "${{ secrets.FLUTTER_STORE_FILE }}" | base64 -d > android/app/release-key.jks
- name: Install Dependencies
run: flutter pub get
- name: Build APK
run: |
flutter build apk --release
- name: Rename APK
run: mv build/app/outputs/flutter-apk/app-release.apk build/app/outputs/flutter-apk/InnerBreeze.apk
- name: Upload APKs as Artifact
uses: actions/upload-artifact@v4
with:
name: apk-artifacts
path: |
build/app/outputs/flutter-apk/InnerBreeze.apk
linux:
needs: cancel
name: Build Linux
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Cache Flutter SDK
uses: actions/cache@v2
with:
path: |
~/.pub-cache
~/.flutter
key: ${{ runner.os }}-flutter-${{ env.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.yaml') }}
restore-keys: |
${{ runner.os }}-flutter-${{ env.FLUTTER_VERSION }}-
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
clang \
cmake \
ninja-build \
pkg-config \
libgtk-3-dev \
libunwind-dev \
liborc-dev \
liblzma-dev \
gstreamer1.0-plugins-base \
gstreamer1.0-libav \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-ugly \
libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev \
libpangocairo-1.0-0 \
libpango-1.0-0 \
libharfbuzz0b \
libatk1.0-0 \
libcairo-gobject2 \
libcairo2
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Install Dependencies
run: flutter pub get
- name: Build Linux Executable
run: |
flutter build linux --release
- name: Create AppImage
run: |
sudo apt-get update
sudo apt-get install -y libfuse2
# Download appimagetool from GitHub
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
chmod a+x appimagetool-x86_64.AppImage
# Make Appdir
cp -r build/linux/x64/release/bundle InnerBreeze.AppDir
# Add the AppRun script
echo -e '#!/bin/bash\ncurrent_dir="$(dirname "$(readlink -f "$0")")"\n"$current_dir/inner_breeze"' > InnerBreeze.AppDir/AppRun
chmod +x InnerBreeze.AppDir/AppRun
# Copy the existing desktop file
cp snap/gui/io.naox.InnerBreeze.desktop InnerBreeze.AppDir/InnerBreeze.desktop
cp snap/gui/io.naox.InnerBreeze.png InnerBreeze.AppDir/io.naox.InnerBreeze.png
# Debug output
echo "Contents of InnerBreeze.AppDir:"
ls -R InnerBreeze.AppDir
./appimagetool-x86_64.AppImage InnerBreeze.AppDir
mv Inner_Breeze-x86_64.AppImage InnerBreeze-x86_64.AppImage
# Debug output
echo "Contents of current directory:"
ls -l
# Verify AppImage creation
if [ -f InnerBreeze-x86_64.AppImage ]; then
echo "AppImage created successfully"
else
echo "AppImage creation failed"
exit 1
fi
- name: Archive Linux executable
run: |
mkdir -p organized_output/InnerBreeze-x86_64/
mv build/linux/x64/release/bundle/* organized_output/InnerBreeze-x86_64/
cp -r metadata organized_output/InnerBreeze-x86_64/
cp -r snap organized_output/InnerBreeze-x86_64/
cd organized_output
tar -czf ../InnerBreeze-Linux-x86_64.tar.gz InnerBreeze-x86_64/
- name: Upload Linux Artifacts
uses: actions/upload-artifact@v4
with:
name: linux-artifacts
path: |
InnerBreeze-Linux-x86_64.tar.gz
InnerBreeze-x86_64.AppImage
release:
name: Release Builds
needs: [android, linux]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Download APK Artifact
uses: actions/download-artifact@v4
with:
name: apk-artifacts
path: build/app/outputs/flutter-apk/
- name: Download Linux Artifacts
uses: actions/download-artifact@v4
with:
name: linux-artifacts
path: build/linux/
- name: Create Release and Upload Builds
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ env.RELEASE_TAG }}"
prerelease: "${{ env.IS_PRERELEASE }}"
title: "${{ env.RELEASE_TAG }}"
files: |
build/app/outputs/flutter-apk/InnerBreeze.apk
build/linux/InnerBreeze-Linux-x86_64.tar.gz
build/linux/InnerBreeze-x86_64.AppImage