Update release-dimmer.yml #30
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 and Release Dimmer | |
on: push | |
jobs: | |
build-windows: | |
name: Build and Package Windows Installer | |
runs-on: windows-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 9.0 | |
- name: Install .NET MAUI Workload | |
run: | | |
dotnet workload install maui | |
dotnet workload install android | |
- name: Add Local NuGet Source | |
dotnet nuget add source $(pwd)/Dimmer/releasePacking --name local-release-packing | |
- name: Configure DevExpress NuGet Source | |
run: dotnet nuget add source ${{ secrets.DEVEXPRESS_FEED_URL }} -n DevExpress | |
- name: Restore NuGet Packages | |
run: dotnet restore ./Dimmer/Dimmer-MAUI.csproj | |
- name: Publish Windows Build | |
run: dotnet publish ./Dimmer/Dimmer-MAUI.csproj -f net9.0-windows10.0.19041.0 -c Release -r win-x64 --self-contained=false -p:WindowsPackageType=None -o ./Dimmer/windows-output --verbosity detailed | |
- name: Download and Install Inno Setup | |
run: | | |
$innoSetupUrl = "https://files.jrsoftware.org/is/innosetup-6.2.2.exe" # Update if newer version | |
$installerPath = "innosetup.exe" | |
Invoke-WebRequest -Uri $innoSetupUrl -OutFile $installerPath | |
Start-Process -Wait -FilePath $installerPath -ArgumentList "/VERYSILENT /SUPPRESSMSGBOXES /NORESTART" | |
- name: Package with Inno Setup | |
run: ISCC.exe /dMySourceDir=windows-output /o Output ./Dimmer/releasePacking/setup_dimmer.iss | |
working-directory: Dimmer-MAUI/Dimmer | |
- name: Verify Installer Exists | |
run: | | |
if (Test-Path -Path "./Output/Setup_Dimmer.exe") { | |
Write-Host "Success: Installer file found at ./Output/Setup_Dimmer.exe" | |
} else { | |
Write-Host "Error: Inno Setup did not create the installer file at ./Output/Setup_Dimmer.exe" | |
exit 1 | |
} | |
working-directory: Dimmer-MAUI/Dimmer | |
- name: Upload Windows Installer Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dimmer-windows-installer | |
path: Dimmer-MAUI/Dimmer/Output/Setup_Dimmer.exe | |
# build-android: | |
# name: Build Android APK | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout Repository | |
# uses: actions/checkout@v3 | |
# - name: Setup .NET | |
# uses: actions/setup-dotnet@v3 | |
# with: | |
# dotnet-version: 9.0 | |
# - name: Restore NuGet packages | |
# run: dotnet restore Dimmer-MAUI.csproj | |
# - name: Build Android APK | |
# run: dotnet publish Dimmer-MAUI.csproj -f net9.0-android -c Release /p:AndroidKeyStorePath=${{ secrets.KEYSTORE_PATH }} /p:AndroidKeyStorePassword=${{ secrets.KEYSTORE_PASSWORD }} /p:AndroidKeyAlias=${{ secrets.KEYSTORE_ALIAS }} /p:AndroidKeyPassword=${{ secrets.KEY_PASSWORD }} -o ./android-output | |
# - name: Sign APK (using apksigner) | |
# run: | | |
# apk_path=$(find ./android-output -name "*.apk") | |
# apksigner sign --ks ${{ secrets.KEYSTORE_PATH }} --ks-pass pass:"${{ secrets.KEYSTORE_PASSWORD }}" --key-pass pass:"${{ secrets.KEY_PASSWORD }}" --ks-key-alias "${{ secrets.KEYSTORE_ALIAS }}" --out ./android-output/Dimmer-Signed.apk $apk_path | |
# - name: Align APK | |
# run: | | |
# aligned_apk_path="./android-output/Dimmer-Aligned.apk" | |
# unsigned_apk_path=$(find ./android-output -name "*.apk" ! -name "*-Aligned.apk" ! -name "*-Signed.apk") | |
# zipalign -v 4 "$unsigned_apk_path" "$aligned_apk_path" | |
# - name: Upload Android APK Artifact | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: dimmer-android-apk | |
# path: ./android-output/Dimmer-Aligned.apk | |
release: | |
name: Create GitHub Release | |
needs: [build-windows] # Only needs the Windows build for now | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Download Windows Installer Artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: dimmer-windows-installer | |
path: ./release-assets/windows | |
# - name: Download Android APK Artifact | |
# uses: actions/download-artifact@v3 | |
# with: | |
# name: dimmer-android-apk | |
# path: ./release-assets/android | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.event.release.tag_name }} | |
release_name: ${{ github.event.release.name }} | |
body_path: .github/release-notes.md # Optional | |
draft: false | |
prerelease: ${{ github.event.release.prerelease }} | |
- name: Upload Windows Installer to Release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./release-assets/windows/Setup_Dimmer.exe | |
asset_name: Setup_Dimmer.exe | |
asset_content_type: application/x-msdownload | |
# - name: Upload Android APK to Release | |
# uses: actions/upload-release-asset@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# upload_url: ${{ steps.create_release.outputs.upload_url }} | |
# asset_path: ./release-assets/android/Dimmer-Aligned.apk | |
# asset_name: Dimmer.apk | |
# asset_content_type: application/vnd.android.package-archive |