Files
2023-02-25 20:25:11 +01:00

52 lines
1.9 KiB
Bash

#!/bin/bash
#
# This hook will build the application before pushing
# Get version number
version=$(cat pubspec.yaml | grep -o -P '(?<=version: ).*(?= # Current version)')
# Replace version in constants.dart with the version number
sed -i "s/currentVersion = \".*\";/currentVersion = \"$version\";/g" lib/components/constants.dart
# Add constants.dart to commit
git add lib/components/constants.dart
# Append to pubspec.yaml
if ! grep -q msix_config "pubspec.yaml"; then
cat ./certs/msix_config.yaml >> pubspec.yaml
fi
# Replace msix_version in pubspec.yaml with the version number
sed -i "s/msix_version: .*\.0/msix_version: $version\.0/g" pubspec.yaml
# Build msix package
flutter pub get
flutter pub run msix:create
# Create release dir
# mkdir -p build/windows/runner/Release
# cp windows-dlls/*.dll build/windows/runner/Release
# Remove the msix_config from pubspec.yaml
sed -i '/^# start git-block-ignore/,/^# end git-block-ignore/{/^123/!d}' pubspec.yaml
# Add & commit the changes
git add -f pubspec.yaml
git add -f build/windows/runner/Release/desktop_window_plugin.dll
git add -f build/windows/runner/Release/flutter_acrylic_plugin.dll
git add -f build/windows/runner/Release/flutter_windows.dll
git add -f build/windows/runner/Release/window_manager_plugin.dll
git add -f build/windows/runner/Release/screen_retriever_plugin.dll
git add -f build/windows/runner/Release/system_theme_plugin.dll
git add -f build/windows/runner/Release/url_launcher_windows_plugin.dll
git add -f build/windows/runner/Release/wsl2distromanager.exe
git add -f build/windows/runner/Release/wsl2distromanager.msix
git add -f build/windows/runner/Release/data
# git add -f build/windows/runner/Release/msvcp140.dll
# git add -f build/windows/runner/Release/vcruntime140_1.dll
# git add -f build/windows/runner/Release/vcruntime140.dll
git commit -s -m "Update version number to $version"
git push --no-verify