release-build workflow creation with choco publish support

[android] always Black StatusBar fix
This commit is contained in:
Kingkor Roy Tirtho 2022-04-26 17:48:44 +06:00
parent cea6fd9797
commit 91ce0bd17c
10 changed files with 125 additions and 17 deletions

View File

@ -57,13 +57,11 @@ jobs:
- run: choco install make -y
- run: make innoinstall
- run: make inno
- run: make choco
- uses: actions/upload-artifact@v2
with:
name: Spotube-Windows-Bundle
path: |
build/installer/Spotube-windows-x86_64-setup.exe
build/spotube.*.nupkg
build_macos:
runs-on: macos-11
steps:

73
.github/workflows/release-build.yml vendored Normal file
View File

@ -0,0 +1,73 @@
name: Spotube Build & Release
on:
release:
types:
- published
jobs:
publish_chocolatey:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
ref: release-test
- uses: actions/checkout@v3
with:
repository: KRTirtho/flutter_distributor
ref: deb-implementation
path: build/flutter_distributor
# bump chocolatey related versions
env:
RELEASE_VERSION: ${{ github.event.release.tag_name }}
- name: Replace Version in files
run: |
sed -i "s/%{{SPOTUBE_VERSION}}%/$RELEASE_VERSION/" windows/runner/Runner.rc
sed -i "s/%{{SPOTUBE_VERSION}}%/$RELEASE_VERSION/" choco-struct/tools/VERIFICATION.txt
sed -i "s/%{{SPOTUBE_VERSION}}%/$RELEASE_VERSION/" choco-struct/spotube.nuspec
- name: Build Windows Executable
uses: subosito/flutter-action@v2.2.0
with:
cache: true
run: |
choco install sed make -y
flutter config --enable-windows-desktop
flutter pub get
dart bin/create-secrets.dart '${{ secrets.LYRICS_SECRET }}' '${{ secrets.SPOTIFY_SECRET }}'
make innoinstall
dart pub global activate --source path build/flutter_distributor/packages/flutter_distributor
flutter_distributor package --platform=windows --target=exe --skip-clean
- name: Create Chocolatey Package
# setting the sha256 hash for new bundle
run: |
Set-Variable -Name HASH -Value (Get-FileHash dist\$RELEASE_VERSION\spotube-$RELEASE_VERSION-windows.exe).Hash
sed -i "s/%{{WIN_SHA256}}%/$HASH/" choco-struct/tools/VERIFICATION.txt
make VERSION=$RELEASE_VERSION choco
- name: Rename the artifacts
run: |
Rename-Item -Path dist/$RELEASE_VERSION/spotube.$RELEASE_VERSION.nupkg -NewName Spotube-windows-x86_64.nupkg
Rename-Item -Path dist/$RELEASE_VERSION/spotube-$RELEASE_VERSION-windows.exe Spotube-windows-x86_64-setup.exe
- name: Upload release binary
uses: meeDamian/github-release@2.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.event.release.tag_name }}
files: dist/$RELEASE_VERSION
- name: Publish to Chocolatey Repository
run: |
choco apikey -k ${{ secrets.CHOCO_API_KEY }} -s https://push.chocolatey.org/
echo 'published to community.chocolatey.org'
# choco push dist/$RELEASE_VERSION/spotube.$RELEASE_VERSION.nupkg
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: Spotube-Windows-Bundle
path: dist/$RELEASE_VERSION

View File

@ -47,8 +47,8 @@ inno:
powershell build\iscc\iscc.exe scripts\windows-setup-creator.iss
choco:
powershell cp build\installer\Spotube-windows-x86_64-setup.exe choco-struct\tools
powershell choco pack .\choco-struct\spotube.nuspec --outputdirectory build
powershell cp dist\${VERSION}\spotube-${VERSION}-windows.exe choco-struct\tools
powershell choco pack .\choco-struct\spotube.nuspec --outputdirectory dist\${VERSION}\
apk:
mv build/app/outputs/apk/release/app-release.apk build/Spotube-android-all-arch.apk

View File

@ -4,7 +4,7 @@
<metadata>
<!-- == PACKAGE SPECIFIC SECTION == -->
<id>spotube</id>
<version>2.0.0</version>
<version>%{{SPOTUBE_VERSION}}%</version>
<packageSourceUrl>https://github.com/KRTirtho/spotube/tree/master/choco-struct</packageSourceUrl>
<owners>Kingkor Roy Tirtho</owners>
<!-- ============================== -->
@ -39,9 +39,9 @@
- Lyrics
- Downloadable track (WIP)
</description>
<releaseNotes>https://github.com/KRTirtho/spotube/releases/tag/v2.0.0</releaseNotes>
<releaseNotes>https://github.com/KRTirtho/spotube/releases/tag/v%{{SPOTUBE_VERSION}}%</releaseNotes>
</metadata>
<files>
<file src="tools\**" target="tools" />
</files>
</package>
</package>

View File

@ -7,17 +7,17 @@ in verifying that this package's contents are trustworthy.
Please go to releases page
https://github.com/KRTirtho/spotube/releases
Download same version as this choco package (example for v2.0.0)
https://github.com/KRTirtho/spotube/releases/tag/v2.0.0
Download same version as this choco package (example for v%{{SPOTUBE_VERSION}}%)
https://github.com/KRTirtho/spotube/releases/tag/v%{{SPOTUBE_VERSION}}%
1. get hashes. Run:
powershell -command Get-FileHash tools\Spotube-windows-x86_64-setup.exe
2. The checksums should match the following:
---
Version Hashes for v2.0.0
Version Hashes for v%{{SPOTUBE_VERSION}}%
Algorithm Hash Path
--------- ---- ----
SHA256 0b60f232a8c17686b7751a36787c9490b35ff6f3139955c72a11c8db19317a91 tools\Spotube-windows-x86_64-setup.exe
SHA256 %{{WIN_SHA256}}% tools\Spotube-windows-x86_64-setup.exe

View File

@ -2,6 +2,7 @@ import 'dart:io';
import 'package:bitsdojo_window/bitsdojo_window.dart';
import 'package:flutter/material.dart' hide Page;
import 'package:flutter/services.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
@ -191,6 +192,19 @@ class Home extends HookConsumerWidget {
],
));
final brightness = Theme.of(context).brightness;
useEffect(() {
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(
statusBarColor: brightness == Brightness.dark
? Colors.blueGrey[900]
: Colors.white, // status bar color
),
);
return null;
}, [brightness]);
return SafeArea(
child: Scaffold(
body: Column(

View File

@ -18,14 +18,14 @@ class Lyrics extends HookConsumerWidget {
UserPreferences userPreferences = ref.watch(userPreferencesProvider);
final lyrics = useState({});
final lyricsFuture = useMemoized(() {
final lyricsFuture = useMemoized(() async {
if (playback.currentTrack == null ||
userPreferences.geniusAccessToken.isEmpty ||
(playback.currentTrack?.id != null &&
playback.currentTrack?.id == lyrics.value["id"])) {
return null;
}
return getLyrics(
final lyricsStr = await getLyrics(
playback.currentTrack!.name!,
playback.currentTrack!.artists
?.map((s) => s.name)
@ -35,6 +35,8 @@ class Lyrics extends HookConsumerWidget {
apiKey: userPreferences.geniusAccessToken,
optimizeQuery: true,
);
if (lyricsStr == null) return Future.error("No lyrics found");
return lyricsStr;
}, [playback.currentTrack, userPreferences.geniusAccessToken]);
final lyricsSnapshot = useFuture(lyricsFuture);
@ -63,6 +65,17 @@ class Lyrics extends HookConsumerWidget {
final breakpoint = useBreakpoints();
if (lyrics.value["lyrics"] == null && playback.currentTrack != null) {
if (lyricsSnapshot.hasError) {
return Expanded(
child: Center(
child: Text(
"Sorry, no Lyrics were found for `${playback.currentTrack?.name}` :'(",
style: Theme.of(context).textTheme.headline4,
textAlign: TextAlign.center,
),
),
);
}
return const Expanded(
child: Center(
child: CircularProgressIndicator.adaptive(),

View File

@ -1,5 +1,6 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
@ -45,6 +46,15 @@ class PlayerView extends HookConsumerWidget {
final PaletteColor paletteColor = usePaletteColor(context, albumArt);
useEffect(() {
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(
statusBarColor: paletteColor.color, // status bar color
),
);
return null;
}, [paletteColor.color]);
return SafeArea(
child: Scaffold(
appBar: const PageWindowTitleBar(

View File

@ -43,10 +43,10 @@ class MyApp extends HookConsumerWidget {
MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context, ref) {
var themeMode =
final themeMode =
ref.watch(userPreferencesProvider.select((s) => s.themeMode));
var player = ref.watch(audioPlayerProvider);
var youtube = ref.watch(youtubeProvider);
final player = ref.watch(audioPlayerProvider);
final youtube = ref.watch(youtubeProvider);
useEffect(() {
return () {
player.dispose();

View File

@ -69,7 +69,7 @@ IDI_APP_ICON ICON "resources\\icon.ico"
#ifdef FLUTTER_BUILD_NAME
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME
#else
#define VERSION_AS_STRING "2.0.0"
#define VERSION_AS_STRING "%{{SPOTUBE_VERSION}}%"
#endif
VS_VERSION_INFO VERSIONINFO