Skip to content

Commit

Permalink
chore: try to fix Windows CI
Browse files Browse the repository at this point in the history
  • Loading branch information
w568w committed Mar 7, 2024
1 parent 4357d0d commit 55ee508
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci_ios.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Automated-CI-iOS-Beta

# fixme(2024-3-7): this CI action does not inject GIT_HASH into the build command, so it should not be used for releases.

on:
workflow_dispatch:

Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/ci_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ jobs:
with:
channel: 'stable'

# - name: Install MSVC Build Tools
# uses: microsoft/setup-msbuild@v1.0.2
# with:
# vs-version: '16.0'
# architecture: 'x64'

- name: Prepare Flutter Dependencies
run: |
flutter pub get
Expand All @@ -34,7 +28,7 @@ jobs:
- name: Build Executable
run: |
flutter build windows --release
.\run_build.bat windows
- name: Package Executable
run: 7z a -r -sse ..\..\..\..\build\app\app-release.zip *
Expand Down
24 changes: 19 additions & 5 deletions run_build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,27 @@ echo Executing build runner...
echo.
start /WAIT cmd /C dart run build_runner build --delete-conflicting-outputs

if "%~1"=="android" (
goto build_android
) else if "%~1"=="windows" (
goto build_windows
) else if "%~1"=="aab" (
goto build_app_bundle
) else (
printf "A valid target is required: android, windows, aab\n"
exit /b 1
)

:build_android
echo Build for Android...
echo.
echo Clean old files...
del /Q build\app\DanXi-%version_code%-release.android.apk
start /WAIT cmd /C flutter build apk --release --dart-define=GIT_HASH=!GIT_HASH!
echo Move file...
move build\app\outputs\flutter-apk\app-release.apk build\app\DanXi-%version_code%-release.android.apk
echo Copy file...
copy build\app\outputs\flutter-apk\app-release.apk build\app\DanXi-%version_code%-release.android.apk
echo.
goto end_success

:build_windows
echo Build for Windows...
Expand All @@ -33,19 +45,21 @@ start /WAIT cmd /C flutter build windows --release --dart-define=GIT_HASH=!GIT_H
echo Clean old files...
del /Q build\app\DanXi-%version_code%-release.windows-x64.zip
cd build\windows\runner\Release\
echo Move file...
echo Copy file...
7z a -r -sse ..\..\..\..\build\app\DanXi-%version_code%-release.windows-x64.zip *
cd ..\..\..\..\
echo.
goto end_success

:build_app_bundle
echo Build for App Bundle (Google Play Distribution)...
echo.
echo Clean old files...
del /Q build\app\DanXi-%version_code%-release.android.aab
start /WAIT cmd /C flutter build appbundle --release --dart-define=GIT_HASH=!GIT_HASH!
echo Move file...
move build\app\outputs\bundle\release\app-release.aab build\app\DanXi-%version_code%-release.android.aab
echo Copy file...
copy build\app\outputs\bundle\release\app-release.aab build\app\DanXi-%version_code%-release.android.aab
goto end_success

:end_success
echo Build success.
4 changes: 1 addition & 3 deletions run_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,5 @@ elif [ "$1" == "windows" ]; then
elif [ "$1" == "aab" ]; then
build_bundle
else
build_android
build_windows
build_bundle
printf "A valid target is required: android, windows, aab\n"
fi

0 comments on commit 55ee508

Please sign in to comment.