Skip to content

Build and release windows #31

Build and release windows

Build and release windows #31

Workflow file for this run

name: Build and release windows
on:
workflow_dispatch:
permissions:
contents: write
jobs:
build_and_release_windows:
name: Build and Release for Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Prepare folders
run: |
mkdir keys
- name: Setup secret keys
shell: bash
run: |
echo ${{ secrets.CERTIFICATE }} | base64 --decode > keys/CERTIFICATE.pfx
- name: Get app version from pubspec.yaml
run: |
choco install yq
$full_version=(yq -r .version pubspec.yaml)
$display_version = $full_version -split '\+' | Select-Object -First 1
echo "APP_VERSION=$display_version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Check fetched app version
run: |
echo "${{ env.APP_VERSION }}"
- uses: subosito/flutter-action@v2
- name: Check Flutter version
run: flutter --version
- name: Enable windows build
run: flutter config --enable-windows-desktop
- name: Create release build
run: flutter build windows --release --obfuscate --split-debug-info=build/windows/runner/Outputs/symbols
# We already called build so we skip it in msix to reduce work for the runner
# MSVC++ Redistributables are pre-included in msix
- name: Create msix installer
run: |
dart run msix:create `
--build-windows=false `
--certificate-password=${{ secrets.CERTIFICATE_PASSWORD }} `
--certificate-path=${{ github.workspace }}/keys/CERTIFICATE.pfx `
--output-path=build/windows/runner/Outputs `
--output-name=mkv_profile-${{env.APP_VERSION}}-windows
- name: Check and install MSVCRedist
run: |
$dlls = @(
"msvcp140.dll",
"vcruntime140.dll",
"vcruntime140_1.dll"
)
$missingFiles = $dlls | Where-Object { -not (Test-Path "C:\Windows\System32\$_") }
if ($missingFiles.Count -gt 0) {
Write-Output "One or more required DLLs are missing. Installing Latest MSVCRedist"
choco install -y vcredist140
} else {
Write-Output "All required DLLs are already present."
}
- name: Include MSVC++ redistributables
run: |
$destination="build/windows/runner/Release"
Copy-Item -Path "c:\windows\system32\msvcp140.dll" -Destination $destination
Copy-Item -Path "c:\windows\system32\vcruntime140.dll" -Destination $destination
Copy-Item -Path "c:\windows\system32\vcruntime140_1.dll" -Destination $destination
- name: Create portable zip
run: |
$outputPath = "build/windows/runner/Outputs/mkv_profile-${{ env.APP_VERSION }}-windows.zip"
Compress-Archive -Path "build/windows/runner/Release/*" -DestinationPath $outputPath
- name: Create exe setup installer
run: |
"%ProgramFiles(x86)%\Inno Setup 6\iscc.exe" ^
/DMyAppVersion="${{ env.APP_VERSION }}" ^
"inno_setup.iss"
shell: cmd
- name: Upload to Github release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.APP_VERSION }}
generate_release_notes: true
files: |
build/windows/runner/Outputs/mkv_profile-${{ env.APP_VERSION }}-windows.zip
build/windows/runner/Outputs/mkv_profile-${{ env.APP_VERSION }}-setup-windows.exe
build/windows/runner/Outputs/mkv_profile-${{ env.APP_VERSION }}-windows.msix