LANCommander/.github/workflows/LANCommander.Release.yml
2024-03-14 19:23:09 -05:00

133 lines
5.1 KiB
YAML

name: LANCommander Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
runs-on: windows-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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: ''
- uses: frabert/replace-string-action@v2
name: Swap Path Backslashes
id: swap_path_backslashes
with:
string: '${{ github.workspace }}'
pattern: '\\'
replace-with: '/'
flags: g
# Server
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Setup Node.js environment
uses: actions/setup-node@v3.8.1
- run: cd LANCommander/wwwroot/scripts; npm install
# Windows
- name: Publish Windows
run: dotnet publish "./LANCommander/LANCommander.csproj" -c Release -o _Build_Windows --self-contained --os win -p:PublishSingleFile=true -p:Version="${{ steps.trim_tag_ref.outputs.replaced }}" -p:AssemblyVersion="${{ steps.trim_tag_ref.outputs.replaced }}"
- name: Publish Windows Updater
run: dotnet publish "./LANCommander.AutoUpdater/LANCommander.AutoUpdater.csproj" -c Release -o _Build_Windows --self-contained --os win -p:Version="${{ steps.trim_tag_ref.outputs.replaced }}" -p:AssemblyVersion="${{ steps.trim_tag_ref.outputs.replaced }}"
- name: Rename Windows Updater
run: mv ./_Build_Windows/LANCommander.AutoUpdater.exe ./_Build_Windows/LANCommander.AutoUpdater.exe.Update
- name: Remove Windows Extra Files
run: rm -Recurse -Force ./_Build_Windows/wwwroot/_content/AntDesign/less
# Sign Windows Binary
- name: Sign Windows Binary
uses: nadeemjazmawe/Sign-action-signtool.exe@v0.1
with:
certificate: "${{ secrets.CERTIFICATE }}"
cert-password: "${{ secrets.CERTIFICATE_PASSWORD }}"
filepath: "./_Build_Windows/LANCommander.exe"
# Create Windows ZIP file
- name: Package Windows Build
uses: vimtor/action-zip@v1.2
with:
files: _Build_Windows/
recursive: true
dest: LANCommander-Windows-x64-v${{ steps.trim_tag_ref.outputs.replaced }}.zip
# Linux
- name: Publish Linux
run: dotnet publish "./LANCommander/LANCommander.csproj" -c Release -o _Build_Linux --self-contained --os linux -p:PublishSingleFile=true -p:Version="${{ steps.trim_tag_ref.outputs.replaced }}" -p:AssemblyVersion="${{ steps.trim_tag_ref.outputs.replaced }}"
- name: Remove Linux Extra Files
run: rm -Recurse -Force ./_Build_Linux/wwwroot/_content/AntDesign/less
# Create Linux ZIP file
- name: Package Linux Build
uses: vimtor/action-zip@v1.2
with:
files: _Build_Linux/
recursive: true
dest: LANCommander-Linux-x64-v${{ steps.trim_tag_ref.outputs.replaced }}.zip
# Client
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.3.1
- name: Setup NuGet
uses: NuGet/setup-nuget@v1.1.1
- name: Restore NuGet packages
run: nuget restore LANCommander.sln
- name: Build and Publish Library
run: msbuild LANCommander.Playnite.Extension/LANCommander.PlaynitePlugin.csproj /p:Configuration=Release /p:OutputPath=Build /p:Version="${{ steps.trim_tag_ref.outputs.replaced }}" /p:InformationalVersion="${{ steps.trim_tag_ref.outputs.replaced }}"
- name: Sign Windows Binary
uses: nadeemjazmawe/Sign-action-signtool.exe@v0.1
with:
certificate: "${{ secrets.CERTIFICATE }}"
cert-password: "${{ secrets.CERTIFICATE_PASSWORD }}"
filepath: "./LANCommander.Playnite.Extension/Build/LANCommander.PlaynitePlugin.dll"
- name: Download Playnite Release
uses: robinraju/release-downloader@v1.7
with:
repository: JosefNemec/Playnite
tag: 10.32
fileName: Playnite1032.zip
- name: Extract Playnite
run: Expand-Archive -Path Playnite1032.zip -DestinationPath Playnite
- name: Update Manifest Versioning
uses: fjogeleit/yaml-update-action@main
with:
valueFile: "LANCommander.Playnite.Extension/Build/extension.yaml"
propertyPath: "Version"
value: "${{ steps.trim_tag_ref.outputs.replaced }}"
commitChange: false
- name: Run Playnite Toolbox
run: Playnite/Toolbox.exe pack LANCommander.Playnite.Extension/Build .
- name: List contents of workspace
run: Get-ChildItem -Path ${{ steps.swap_path_backslashes.outputs.replaced }} -Recurse
- name: Draft Release
uses: softprops/action-gh-release@v2
with:
name: v${{ steps.trim_tag_ref.outputs.replaced }}
generate_release_notes: true
draft: true
files: |
${{ steps.swap_path_backslashes.outputs.replaced }}/LANCommander-Windows-x64-*.zip
${{ steps.swap_path_backslashes.outputs.replaced }}/LANCommander-Linux-x64-*.zip
LANCommander.PlaynitePlugin_48e1bac7-e0a0-45d7-ba83-36f5e9e959fc_*.pext