Build installer artifacts #6
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 installer artifacts | |
on: | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
build_and_upload_artifact: | |
name: Build and Upload Artifact for Windows | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- 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/x64/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/x64/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 Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-v${{ env.APP_VERSION }} | |
retention-days: 30 | |
path: | | |
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 |