Skip to content

build: define environment variables in shell script #21

build: define environment variables in shell script

build: define environment variables in shell script #21

Workflow file for this run

name: Build Release
on:
push:
tags:
- "v*.*.*"
jobs:
build-windows:
runs-on: windows-latest
permissions:
contents: write
name: Build Flutter App Windows
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Define Artifact Paths
id: define-artifact-paths
run: |
$runner="build/windows/x64/runner"
$artifacts="$runner/Artifacts"
$build="$runner/Release/"
$artifactName="AndroidSideloader-${{ github.ref_name }}"
$archiveName="$artifactName-Windows-Portable.zip"
$archive="$artifacts/$archiveName"
$installerName="$artifactName-Windows-Installer.exe"
$installer="$artifacts/$installerName"
$packageName="$artifactName.exe"
$package="$artifacts/$packageName"
echo "BUILD_DIR_PATH=$build" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "ARCHIVE_NAME=$archiveName" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "ARCHIVE_PATH=$archive" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "INSTALLER_NAME=$installerName" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "INSTALLER_PATH=$installer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "PACKAGE_NAME=$packageName" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
echo "PACKAGE_PATH=$package" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Extract Release Notes
id: extract_changelog
run: |
$ReleaseNotes = & "scripts/get-release-notes.ps1" -VersionName ${{ github.ref_name }}
if ($LASTEXITCODE -ne 0 -or -not (Test-Path ./ReleaseNotes.md)) {
Write-Error "Failed to create ReleaseNotes.md"
exit 1
}
$ReleaseNotes | Out-File -FilePath "./ReleaseNotes.md" -Encoding utf8
- name: Install Enigma Virtual Box
id: install-enigma
run: |
choco install enigmavirtualbox -y --ignore-checksums
$enigma="C:\Program Files (x86)\Enigma Virtual Box\enigmavbconsole.exe"
echo "ENIGMA=$enigma" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Setup Flutter
uses: subosito/flutter-action@v2.18.0
with:
channel: stable
flutter-version-file: pubspec.yaml
cache: true
- name: Install Dependencies
run: flutter pub get
- name: Build for Windows
run: flutter build windows
- name: Compile .ISS to .EXE Installer
uses: Minionguyjpro/Inno-Setup-Action@v1.2.5
with:
path: installer.iss
options: /O+ /DMyAppVersion="${{ github.ref_name }}"
- name: Create enigma package
run: |
& '${{ env.ENIGMA }}' .\package.evb -output ".\${{ env.PACKAGE_PATH }}"
- name: Compress Build Directory
run: |
Compress-Archive -Path "${{ env.BUILD_DIR_PATH }}\*" -DestinationPath "${{ env.ARCHIVE_PATH }}"
- name: Upload Build Files
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARCHIVE_NAME }}
path: ${{ env.ARCHIVE_PATH }}
- name: Upload Installer Executable as Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.INSTALLER_NAME }}
path: ${{ env.INSTALLER_PATH }}
- name: Upload Enigma Package as Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}
path: ${{ env.PACKAGE_NAME }}
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
tag: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
bodyFile: "ReleaseNotes.md"
replacesArtifacts: true
draft: true
prerelease: true
artifactErrorsFailBuild: true
artifacts: "${{ env.ARCHIVE_PATH }},${{ env.INSTALLER_PATH }},${{ env.PACKAGE_NAME }}"