Skip to content

Commit 393dc8a

Browse files
changelog from previous versions if on super old version, + artifacts should now have proper token to avoid rate limit
1 parent 76605e3 commit 393dc8a

File tree

3 files changed

+28
-5
lines changed

3 files changed

+28
-5
lines changed

.github/workflows/create_artifacts.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ jobs:
2222
- name: Enable desktop support
2323
run: flutter config --enable-windows-desktop
2424
- name: Build Windows app
25-
run: flutter build windows
25+
- shell: bash
26+
env:
27+
TOKEN: ${{ secrets.TOKEN }}
28+
run: flutter build windows --dart-define="TOKEN="$TOKEN""
2629
- name: Copy VC redistributables
2730
run: |
2831
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\msvcp140.dll') .
@@ -52,7 +55,10 @@ jobs:
5255
flutter config --enable-linux-desktop
5356
sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev
5457
- name: Build Linux app
55-
run: flutter build linux
58+
- shell: bash
59+
env:
60+
TOKEN: ${{ secrets.TOKEN }}
61+
run: flutter build linux --dart-define="TOKEN="$TOKEN""
5662
- name: Create artifact
5763
uses: actions/upload-artifact@v2
5864
with:

.github/workflows/create_releases.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ jobs:
1818
- name: Enable desktop support
1919
run: flutter config --enable-windows-desktop
2020
- name: Build Windows app
21-
run: flutter build windows
21+
- shell: bash
22+
env:
23+
TOKEN: ${{ secrets.TOKEN }}
24+
run: flutter build windows --dart-define="TOKEN="$TOKEN""
2225
- name: Copy VC redistributables
2326
run: |
2427
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\msvcp140.dll') .
@@ -50,7 +53,10 @@ jobs:
5053
flutter config --enable-linux-desktop
5154
sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev
5255
- name: Build Linux app
53-
run: flutter build linux
56+
- shell: bash
57+
env:
58+
TOKEN: ${{ secrets.TOKEN }}
59+
run: flutter build linux --dart-define="TOKEN="$TOKEN""
5460
- name: Create zip
5561
uses: papeloto/action-zip@v1
5662
with:

lib/bloc/updater_bloc/updater_bloc.dart

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,25 @@ class UpdaterBloc extends Bloc<UpdaterEvent, UpdaterState> {
1919
) async* {
2020
if (event is CheckForUpdates) {
2121
var url = Uri.parse(URL);
22+
String changelog = '';
23+
int currentVersionIndex = 0;
2224
http.Response response = await http.get(url, headers: {
2325
'Authorization': String.fromEnvironment('TOKEN'),
2426
});
2527
var data = jsonDecode(response.body);
28+
for (var i = 0; i < data.length; i++) {
29+
if (event.currentVersion ==
30+
data[i]['tag_name'].toString().substring(1)) {
31+
currentVersionIndex = i;
32+
}
33+
}
34+
for (var i = 0; i < currentVersionIndex; i++) {
35+
changelog += '\n' + data[i]['body'].toString();
36+
}
2637
String latestVersion = data[0]['tag_name'].toString().substring(1);
2738
String downloadURL =
2839
data[0]['assets'][0]['browser_download_url'].toString();
29-
String changelog = data[0]['body'].toString();
40+
3041
bool updateAvailable =
3142
double.parse(latestVersion) > double.parse(event.currentVersion);
3243
print(latestVersion);

0 commit comments

Comments
 (0)