Skip to content

Release TweakHub 1.0.0 #1

Release TweakHub 1.0.0

Release TweakHub 1.0.0 #1

Workflow file for this run

name: Release
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
inputs:
tag:
description: "Tag name to release (e.g. v1.2.3)"
required: true
permissions:
contents: write
jobs:
build-and-release:
runs-on: windows-2022
env:
DOTNET_VERSION: "10.0.x"
CONFIGURATION: Release
RUNTIME: win-x64
OUTPUT_DIR: publish-standalone
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Determine and validate tag
id: tag
shell: pwsh
run: |
$tag = "${{ github.event.inputs.tag }}"
if ([string]::IsNullOrWhiteSpace($tag) -and "${{ github.ref_type }}" -eq "tag") {
$tag = "${{ github.ref_name }}"
}
if ([string]::IsNullOrWhiteSpace($tag)) {
Write-Error "No release tag found."
}
$version = dotnet msbuild ./TweakHub.csproj -getProperty:Version --nologo
if ($tag.TrimStart('v') -ne $version.Trim()) {
Write-Error "Tag $tag does not match project version $version."
}
echo "tag=$tag" >> $Env:GITHUB_OUTPUT
- name: Restore
run: dotnet restore ./TweakHub.sln
- name: Build
run: dotnet build ./TweakHub.sln -c ${{ env.CONFIGURATION }} --no-restore
- name: Test
run: dotnet test ./TweakHub.Tests/TweakHub.Tests.csproj -c ${{ env.CONFIGURATION }} --no-build --no-restore
- name: Publish portable (self-contained)
run: |
dotnet publish ./TweakHub.csproj -c ${{ env.CONFIGURATION }} -r ${{ env.RUNTIME }} --self-contained true -p:PublishSingleFile=false -o ${{ env.OUTPUT_DIR }}
- name: Archive portable zip
shell: pwsh
run: |
$zip = "dist/TweakHub-${{ steps.tag.outputs.tag }}-${{ env.RUNTIME }}-portable.zip"
New-Item -ItemType Directory -Force -Path dist | Out-Null
Compress-Archive -Path "${{ env.OUTPUT_DIR }}/*" -DestinationPath $zip
- name: Build installer
shell: pwsh
run: |
$iscc = "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe"
if (!(Test-Path $iscc)) {
choco install innosetup --no-progress -y
}
& $iscc "installer\TweakHub.iss"
- name: Create SHA-256 checksums
shell: pwsh
run: |
$files = @(Get-Item "dist/*.zip") + @(Get-Item "installer/Output/*.exe")
foreach ($file in $files) {
$hash = (Get-FileHash $file.FullName -Algorithm SHA256).Hash.ToLowerInvariant()
"$hash $($file.Name)" | Set-Content "$($file.FullName).sha256" -Encoding ascii
}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.tag }}
name: TweakHub ${{ steps.tag.outputs.tag }}
prerelease: ${{ contains(steps.tag.outputs.tag, '-') }}
draft: false
generate_release_notes: true
files: |
dist/TweakHub-${{ steps.tag.outputs.tag }}-${{ env.RUNTIME }}-portable.zip
dist/*.sha256
installer/Output/*.exe
installer/Output/*.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}