mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00

* feat: add build dart script for windows * feat: add android build support * feat: add linux build support * feat: add macos build support * feat: add ios build support * feat: add deps install command and workflow file * cd: what? * cd: what? * cd: what? * cd: update workflow inputs * cd: replace release binary * cd: run flutter pub get * cd: use dpkg zstd instead of xz, windows disable innoInstall, fix channel enum.name and reset pubspec after changing build no for nightly * cd: fix tar copy path * cd: fix copy linux command * cd: fix windows inno depend and fix android aab path * cd: idk * cd: linux why??? * cd: windows choco copy failed * cd: use dart tar archive for creating tar file * cd: fix linux file copy error * cd: use tar command directly * feat: add linux_arm platform * cd: add linux_arm platform * cd: don't know what? * feat: notification about nightly channel update * chore: fix some errors parsing nightly version info
67 lines
1.7 KiB
Dart
67 lines
1.7 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:args/command_runner.dart';
|
|
import 'package:path/path.dart';
|
|
import 'package:process_run/shell_run.dart';
|
|
import 'package:pubspec_parse/pubspec_parse.dart';
|
|
|
|
import '../../core/env.dart';
|
|
|
|
mixin BuildCommandCommonSteps on Command {
|
|
final shell = Shell();
|
|
Directory get cwd => Directory.current;
|
|
|
|
Pubspec? _pubspec;
|
|
|
|
Pubspec get pubspec {
|
|
if (_pubspec != null) {
|
|
return _pubspec!;
|
|
}
|
|
|
|
final pubspecFile = File(join(cwd.path, "pubspec.yaml"));
|
|
_pubspec = Pubspec.parse(pubspecFile.readAsStringSync());
|
|
|
|
return _pubspec!;
|
|
}
|
|
|
|
String get versionWithoutBuildNumber {
|
|
return "${pubspec.version!.major}.${pubspec.version!.minor}.${pubspec.version!.patch}";
|
|
}
|
|
|
|
RegExp get versionVarRegExp =>
|
|
RegExp(r"\%\{\{SPOTUBE_VERSION\}\}\%", multiLine: true);
|
|
|
|
File get dotEnvFile => File(join(cwd.path, ".env"));
|
|
|
|
Future<void> bootstrap() async {
|
|
await dotEnvFile.create(recursive: true);
|
|
|
|
await dotEnvFile.writeAsString(
|
|
"${CliEnv.dotenv}\n"
|
|
"RELEASE_CHANNEL=${CliEnv.channel.name}\n",
|
|
);
|
|
|
|
if (CliEnv.channel == BuildChannel.nightly) {
|
|
final pubspecFile = File(join(cwd.path, "pubspec.yaml"));
|
|
|
|
pubspecFile.writeAsStringSync(
|
|
pubspecFile.readAsStringSync().replaceAll(
|
|
"version: ${pubspec.version!.canonicalizedVersion}",
|
|
"version: $versionWithoutBuildNumber+${CliEnv.ghRunNumber}",
|
|
),
|
|
);
|
|
|
|
_pubspec = null;
|
|
pubspec;
|
|
}
|
|
|
|
await shell.run(
|
|
"""
|
|
flutter pub get
|
|
dart run build_runner build --delete-conflicting-outputs
|
|
dart pub global activate flutter_distributor
|
|
""",
|
|
);
|
|
}
|
|
}
|