mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 16:05:18 +00:00
create-secrets is now argv based
This commit is contained in:
parent
195f965e24
commit
a4b2f06737
8
.github/workflows/flutter-build.yml
vendored
8
.github/workflows/flutter-build.yml
vendored
@ -13,14 +13,12 @@ jobs:
|
|||||||
- uses: subosito/flutter-action@v2.2.0
|
- uses: subosito/flutter-action@v2.2.0
|
||||||
with:
|
with:
|
||||||
cache: true
|
cache: true
|
||||||
env:
|
|
||||||
SECRET: ${{ secrets.SECRET }}
|
|
||||||
- run: |
|
- run: |
|
||||||
sudo apt-get update -y
|
sudo apt-get update -y
|
||||||
sudo apt-get install -y tar clang cmake ninja-build pkg-config libgtk-3-dev make libwebkit2gtk-4.0-dev keybinder-3.0 python3-pip python3-setuptools patchelf desktop-file-utils libgdk-pixbuf2.0-dev fakeroot strace fuse
|
sudo apt-get install -y tar clang cmake ninja-build pkg-config libgtk-3-dev make libwebkit2gtk-4.0-dev keybinder-3.0 python3-pip python3-setuptools patchelf desktop-file-utils libgdk-pixbuf2.0-dev fakeroot strace fuse
|
||||||
- run: flutter config --enable-linux-desktop
|
- run: flutter config --enable-linux-desktop
|
||||||
- run: flutter pub get
|
- run: flutter pub get
|
||||||
- run: dart bin/create-secrets.dart
|
- run: dart bin/create-secrets.dart ${{ secrets.SECRET }}
|
||||||
- run: flutter clean
|
- run: flutter clean
|
||||||
- run: flutter build linux
|
- run: flutter build linux
|
||||||
- run: make deb
|
- run: make deb
|
||||||
@ -50,7 +48,7 @@ jobs:
|
|||||||
SECRET: ${{ secrets.SECRET }}
|
SECRET: ${{ secrets.SECRET }}
|
||||||
- run: flutter config --enable-windows-desktop
|
- run: flutter config --enable-windows-desktop
|
||||||
- run: flutter pub get
|
- run: flutter pub get
|
||||||
- run: dart bin/create-secrets.dart
|
- run: dart bin/create-secrets.dart ${{ secrets.SECRET }}
|
||||||
- run: flutter build windows
|
- run: flutter build windows
|
||||||
- run: choco install make -y
|
- run: choco install make -y
|
||||||
- run: make innoinstall
|
- run: make innoinstall
|
||||||
@ -73,7 +71,7 @@ jobs:
|
|||||||
SECRET: ${{ secrets.SECRET }}
|
SECRET: ${{ secrets.SECRET }}
|
||||||
- run: flutter config --enable-macos-desktop
|
- run: flutter config --enable-macos-desktop
|
||||||
- run: flutter pub get
|
- run: flutter pub get
|
||||||
- run: dart bin/create-secrets.dart
|
- run: dart bin/create-secrets.dart ${{ secrets.SECRET }}
|
||||||
- run: flutter build macos
|
- run: flutter build macos
|
||||||
- run: du -sh build/macos/Build/Products/Release/spotube.app
|
- run: du -sh build/macos/Build/Products/Release/spotube.app
|
||||||
- run: npm install -g appdmg
|
- run: npm install -g appdmg
|
||||||
|
@ -3,17 +3,18 @@ import 'dart:io';
|
|||||||
|
|
||||||
import 'package:path/path.dart' as path;
|
import 'package:path/path.dart' as path;
|
||||||
|
|
||||||
void main() async {
|
void main(List<String> args) async {
|
||||||
final env = Platform.environment;
|
if (args.isEmpty) {
|
||||||
final bool hasKey = env.containsKey("SECRET");
|
throw ArgumentError("Expected an argument but none was passed");
|
||||||
final val = hasKey ? jsonDecode(env["SECRET"]!) : null;
|
}
|
||||||
print("SECRET VALUE: ${env["SECRET"]}");
|
|
||||||
if (!hasKey || (hasKey && val is! List)) {
|
final val = jsonDecode(args.first);
|
||||||
|
if (val is! List) {
|
||||||
throw Exception(
|
throw Exception(
|
||||||
"'SECRET' Environmental Variable isn't configured properly");
|
"'SECRET' Environmental Variable isn't configured properly");
|
||||||
}
|
}
|
||||||
|
|
||||||
await File(path.join(
|
await File(path.join(
|
||||||
Directory.current.path, "lib/models/generated_secrets.dart"))
|
Directory.current.path, "lib/models/generated_secrets.dart"))
|
||||||
.writeAsString("final List<String> secrets = ${env["SECRET"]};");
|
.writeAsString("final List<String> secrets = ${args.first};");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user