LANCommander/.github/workflows/LANCommander.Launcher.WinGet.Release.yml
2025-02-16 23:37:30 -06:00

165 lines
No EOL
6.5 KiB
YAML

name: LANCommander Launcher WinGet Release
on:
release:
types: [published]
permissions:
contents: write
env:
WINGET_REPO: microsoft/winget-pkgs
PUBLISHER: LANCommander
PACKAGE_NAME: Launcher
jobs:
prep:
runs-on: ubuntu-latest
outputs:
version_tag: ${{ steps.trim_tag_ref.outputs.replaced }}
version_semver: ${{ steps.trim_tag_ref.outputs.replaced }}
steps:
- uses: frabert/replace-string-action@v2
name: Trim Tag Ref
id: trim_tag_ref
with:
string: '${{ github.ref }}'
pattern: 'refs/tags/v'
replace-with: ''
build_launcher_win_x64:
needs: prep
uses: ./.github/workflows/LANCommander.Launcher.yml
with:
version_semver: ${{ needs.prep.outputs.version_semver }}
version_tag: ${{ needs.prep.outputs.version_tag }}
build_runtime: win-x64
build_arch: x64
build_platform: Windows
build_launcher_win_arm64:
needs: prep
uses: ./.github/workflows/LANCommander.Launcher.yml
with:
version_semver: ${{ needs.prep.outputs.version_semver }}
version_tag: ${{ needs.prep.outputs.version_tag }}
build_runtime: win-arm64
build_arch: arm64
build_platform: Windows
create_installers:
needs: [prep, build_launcher_win_x64, build_launcher_win_arm64]
runs-on: windows-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Download x64 Launcher
uses: actions/download-artifact@v4
with:
name: LANCommander.Launcher-Windows-x64-v${{ needs.prep.outputs.version_tag }}
path: ./build/win-x64
- name: Download ARM64 Launcher
uses: actions/download-artifact@v4
with:
name: LANCommander.Launcher-Windows-arm64-v${{ needs.prep.outputs.version_tag }}
path: ./build/win-arm64
- name: Download Inno Setup
uses: suisei-cn/actions-download-file@v1.4.0
with:
url: https://files.jrsoftware.org/is/6/innosetup-6.2.2.exe
target: ./setup/
- name: Install Inno Setup
run: |
Start-Process -FilePath "./setup/innosetup-6.2.2.exe" -ArgumentList "/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-" -Wait
- name: Create x64 Installer
run: |
& 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' /DMyAppVersion="${{ needs.prep.outputs.version_tag }}" /DMyAppArchitecture="x64" /DMyAppBuildDir="build\win-x64" "launcher-installer.iss"
working-directory: ./Installer
- name: Create ARM64 Installer
run: |
& 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' /DMyAppVersion="${{ needs.prep.outputs.version_tag }}" /DMyAppArchitecture="arm64" /DMyAppBuildDir="build\win-arm64" "launcher-installer.iss"
working-directory: ./Installer
- name: Generate SHA256 Hashes
run: |
$x64Hash = (Get-FileHash "Output\LANCommanderLauncher-${{ needs.prep.outputs.version_tag }}-x64.exe" -Algorithm SHA256).Hash.ToLower()
$arm64Hash = (Get-FileHash "Output\LANCommanderLauncher-${{ needs.prep.outputs.version_tag }}-arm64.exe" -Algorithm SHA256).Hash.ToLower()
"X64_HASH=$x64Hash" | Out-File -FilePath $env:GITHUB_ENV -Append
"ARM64_HASH=$arm64Hash" | Out-File -FilePath $env:GITHUB_ENV -Append
working-directory: ./Installer
- name: Upload Installers to Release
uses: softprops/action-gh-release@v2
with:
files: |
./Installer/Output/LANCommanderLauncher-${{ needs.prep.outputs.version_tag }}-x64.exe
./Installer/Output/LANCommanderLauncher-${{ needs.prep.outputs.version_tag }}-arm64.exe
submit_to_winget:
needs: [prep, create_installers]
runs-on: windows-latest
steps:
- name: Checkout WinGet Repository
uses: actions/checkout@v4
with:
repository: ${{ env.WINGET_REPO }}
path: winget-pkgs
- name: Create Package Version Directory
run: |
$versionPath = "manifests/$($env:PUBLISHER[0].ToLower())/$env:PUBLISHER/$env:PACKAGE_NAME/${{ needs.prep.outputs.version_tag }}"
New-Item -Path "winget-pkgs/$versionPath" -ItemType Directory -Force
echo "VERSION_PATH=$versionPath" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Create Manifest
run: |
$manifestContent = @"
PackageIdentifier: $env:PUBLISHER.$env:PACKAGE_NAME
PackageVersion: ${{ needs.prep.outputs.version_tag }}
PackageLocale: en-US
Publisher: $env:PUBLISHER
PackageName: LANCommander Launcher
License: MIT
ShortDescription: Game launcher client for LANCommander servers
Moniker: lancommander-launcher
Tags:
- game-launcher
- lan-party
- game-client
ReleaseNotesUrl: https://github.com/LANCommander/LANCommander/releases/tag/v${{ needs.prep.outputs.version_tag }}
Installers:
- Architecture: x64
InstallerType: inno
InstallerUrl: https://github.com/LANCommander/LANCommander/releases/download/v${{ needs.prep.outputs.version_tag }}/LANCommanderLauncher-${{ needs.prep.outputs.version_tag }}-x64.exe
InstallerSha256: ${{ env.X64_HASH }}
Scope: user
- Architecture: arm64
InstallerType: inno
InstallerUrl: https://github.com/LANCommander/LANCommander/releases/download/v${{ needs.prep.outputs.version_tag }}/LANCommanderLauncher-${{ needs.prep.outputs.version_tag }}-arm64.exe
InstallerSha256: ${{ env.ARM64_HASH }}
Scope: user
ManifestType: version
ManifestVersion: 1.4.0
"@
$manifestContent | Out-File -FilePath "winget-pkgs/$env:VERSION_PATH/$env:PUBLISHER.$env:PACKAGE_NAME.yaml" -Encoding utf8
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
path: winget-pkgs
commit-message: "Add ${{ env.PUBLISHER }}.${{ env.PACKAGE_NAME }} version ${{ needs.prep.outputs.version_tag }}"
title: "Add ${{ env.PUBLISHER }}.${{ env.PACKAGE_NAME }} version ${{ needs.prep.outputs.version_tag }}"
body: |
New version: ${{ needs.prep.outputs.version_tag }}
- Added x64 and ARM64 installers for LANCommander Launcher
branch: "add-lancommander-launcher-${{ needs.prep.outputs.version_tag }}"
base: master
delete-branch: true