yubioath-flutter/.github/workflows/windows.yml
2023-01-25 14:20:26 +01:00

96 lines
2.9 KiB
YAML

name: Windows
on: [push, pull_request]
jobs:
build:
runs-on: windows-latest
env:
PYVER: 3.11
steps:
- uses: actions/checkout@v3
- name: Check app versions
run: |
python set-version.py
git diff --exit-code
- name: Cache helper
id: cache-helper
uses: actions/cache@v3
with:
path: |
build/windows/helper
assets/licenses/helper.json
key: ${{ runner.os }}-py${{ env.PYVER }}-${{ hashFiles('helper/**') }}
- name: Set up Python
if: steps.cache-helper.outputs.cache-hit != 'true'
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYVER }}
- name: Install dependencies
if: steps.cache-helper.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
pip install poetry
- name: Build the Helper
if: steps.cache-helper.outputs.cache-hit != 'true'
run: .\build-helper.bat
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: '3.7.0'
- run: flutter config --enable-windows-desktop
- run: flutter --version
- name: Run tests
run: |
flutter test
flutter analyze
- name: Build the app
run: |
$version = python set-version.py | select-object -first 1
flutter build windows --build-name=$version
- name: Check generated files
run: git diff -I '.*android.*flutter_plugins.*qrscanner_zxing' --exit-code
- name: Move .dll files
run: |
$dest = "build\windows\runner\Release"
cp $dest\helper\MSVCP140.dll $dest\
cp $dest\helper\VCRUNTIME140.dll $dest\
cp $dest\helper\VCRUNTIME140_1.dll $dest\
- name: Create an unsigned .msi installer package
run: |
$env:PATH += ";$env:WIX\bin"
$env:SRCDIR = "build\windows\runner\Release\"
heat dir .\build\windows\runner\Release\ -out fragment.wxs -gg -scom -srd -sfrag -dr INSTALLDIR -cg ApplicationFiles -var env.SRCDIR
candle .\fragment.wxs .\resources\win\yubioath-desktop.wxs -ext WixUtilExtension -arch x64
light fragment.wixobj yubioath-desktop.wixobj -ext WixUIExtension -ext WixUtilExtension -o yubioath-desktop.msi
- name: Rename and archive app bundle
run: |
$arr = $env:GITHUB_REF -split '/'
$branch = $arr[2]
$dest = "deploy\yubioath-desktop-$branch-windows"
mkdir $dest
mv build\windows\runner\Release\* $dest\
mv yubioath-desktop.msi deploy
mv resources\win\release-win.ps1 deploy
mv resources deploy
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: yubioath-desktop-windows
path: deploy