v0.24.2 #134
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build for Windows | |
on: | |
# Enable manual run | |
workflow_dispatch: | |
push: | |
tags: | |
- '**' | |
branches: | |
- '**' | |
paths: | |
- .github/workflows/windows.yml | |
- installers/desktop_inno_script.iss | |
jobs: | |
build-windows: | |
name: Build for Windows | |
runs-on: windows-latest | |
permissions: | |
contents: write | |
timeout-minutes: 20 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
build | |
key: ${{ runner.OS }}-saber-${{ hashFiles('**/pubspec.lock') }}-${{ hashFiles('**/*.dart') }} | |
restore-keys: | | |
${{ runner.OS }}-saber- | |
- name: Remove simulator dependency | |
shell: bash | |
run: ./patches/remove_simulator_dependency.sh | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: stable | |
cache: true | |
cache-key: 'flutter-:os:-:channel:-:version:-:arch:' | |
- run: flutter pub get | |
- name: Build Windows | |
shell: bash | |
run: | | |
flutter build windows \ | |
--dart-define=DIRTY=$DIRTY | |
env: | |
DIRTY: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
- name: Download Visual C++ Redistributable | |
shell: bash | |
run: | | |
curl -L -o installers/vc_redist.x64.exe https://aka.ms/vs/17/release/vc_redist.x64.exe | |
- name: Build Windows Installer | |
run: ISCC.exe installers/desktop_inno_script.iss | |
- name: Rename exe | |
id: rename | |
shell: bash | |
run: | | |
export LC_ALL=en_US.utf8 | |
buildName=$(grep -oP "(?<=buildName = ').*(?=')" lib/data/version.dart) | |
installerName="SaberInstaller_v${buildName}.exe" | |
echo "installerName=$installerName" >> $GITHUB_OUTPUT | |
mv installers/SaberInstaller.exe installers/$installerName | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Saber-Windows | |
path: installers/${{ steps.rename.outputs.installerName }} | |
- name: Upload to GitHub release | |
uses: svenstaro/upload-release-action@v2 | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: installers/${{ steps.rename.outputs.installerName }} |