Skip to content

docs: Update CHANGELOG.md to record changes in version 1.1.0 #13

docs: Update CHANGELOG.md to record changes in version 1.1.0

docs: Update CHANGELOG.md to record changes in version 1.1.0 #13

name: Build and Release
on:
push:
tags:
- 'v*'
jobs:
build-and-release:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Get version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
shell: bash
- name: Extract latest changelog
id: changelog
run: |
$content = Get-Content CHANGELOG.md -Raw
$pattern = '(?s)(## \[.*?\].*?)(?=\n---|\Z)'
if ($content -match $pattern) {
$latest = $matches[1].Trim()
echo "CONTENT<<EOF" >> $env:GITHUB_OUTPUT
echo "$latest" >> $env:GITHUB_OUTPUT
echo "EOF" >> $env:GITHUB_OUTPUT
}
shell: pwsh
- name: Restore
run: dotnet restore DevTools.csproj
- name: Publish win-x86
run: dotnet publish DevTools.csproj -c Release -r win-x86 --self-contained true /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true /p:PublishTrimmed=false -o publish\win-x86
- name: Publish win-x64
run: dotnet publish DevTools.csproj -c Release -r win-x64 --self-contained true /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true /p:PublishTrimmed=false -o publish\win-x64
- name: Publish win-arm64
run: dotnet publish DevTools.csproj -c Release -r win-arm64 --self-contained true /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true /p:PublishTrimmed=false -o publish\win-arm64
- name: Decode signing certificate
if: env.CERTIFICATE_BASE64 != ''
env:
CERTIFICATE_BASE64: ${{ secrets.CERTIFICATE_BASE64 }}
run: |
$certPath = Join-Path $env:RUNNER_TEMP "cert.pfx"
[System.IO.File]::WriteAllBytes($certPath, [System.Convert]::FromBase64String($env:CERTIFICATE_BASE64))
echo "CERT_PATH=$certPath" >> $env:GITHUB_ENV
shell: pwsh
- name: Sign executables
if: env.CERT_PATH != ''
env:
CERT_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
run: |
$signtool = Get-ChildItem -Path "${env:ProgramFiles(x86)}\Windows Kits\10\bin\*\x64\signtool.exe" | Sort-Object { $_.VersionInfo.FileVersion } -Descending | Select-Object -First 1
$exeFiles = @(
"publish\win-x86\DevTools.exe",
"publish\win-x64\DevTools.exe",
"publish\win-arm64\DevTools.exe"
)
foreach ($exe in $exeFiles) {
Write-Host "Signing: $exe"
& $signtool.FullName sign /f $env:CERT_PATH /p $env:CERT_PASSWORD /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 $exe
if ($LASTEXITCODE -ne 0) {
Write-Host "Warning: Failed to sign $exe"
}
}
shell: pwsh
- name: Install Inno Setup
run: |
choco install innosetup -y
shell: pwsh
- name: Download Chinese language file for Inno Setup
run: |
$innoPath = "${env:ProgramFiles(x86)}\Inno Setup 6"
$langPath = Join-Path $innoPath "Languages"
$chineseFile = Join-Path $langPath "ChineseSimplified.isl"
if (-not (Test-Path $chineseFile)) {
Write-Host "Downloading Chinese Simplified language file..."
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/ChineseSimplified.isl" -OutFile $chineseFile
}
shell: pwsh
- name: Build Installers
run: |
New-Item -ItemType Directory -Force -Path installer
$version = "${{ steps.get_version.outputs.VERSION }}"
$rootDir = $PWD.Path
Write-Host "Building x64 installer..."
& iscc "$rootDir\scripts\installer.iss" /DAppVersion="$version" /DArchitecture="x64" /DOutputDir="$rootDir\installer" /DSourceDir="$rootDir\publish\win-x64"
Write-Host "Building x86 installer..."
& iscc "$rootDir\scripts\installer.iss" /DAppVersion="$version" /DArchitecture="x86" /DOutputDir="$rootDir\installer" /DSourceDir="$rootDir\publish\win-x86"
Write-Host "Building arm64 installer..."
& iscc "$rootDir\scripts\installer.iss" /DAppVersion="$version" /DArchitecture="arm64" /DOutputDir="$rootDir\installer" /DSourceDir="$rootDir\publish\win-arm64"
shell: pwsh
- name: Sign installers
if: env.CERT_PATH != ''
env:
CERT_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
run: |
$signtool = Get-ChildItem -Path "${env:ProgramFiles(x86)}\Windows Kits\10\bin\*\x64\signtool.exe" | Sort-Object { $_.VersionInfo.FileVersion } -Descending | Select-Object -First 1
$installerFiles = Get-ChildItem -Path "installer\*.exe"
foreach ($installer in $installerFiles) {
Write-Host "Signing: $($installer.FullName)"
& $signtool.FullName sign /f $env:CERT_PATH /p $env:CERT_PASSWORD /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 $installer.FullName
if ($LASTEXITCODE -ne 0) {
Write-Host "Warning: Failed to sign $($installer.FullName)"
}
}
shell: pwsh
- name: Rename executables
run: |
Rename-Item -Path publish\win-x86\DevTools.exe -NewName DevTools-win-x86.exe
Rename-Item -Path publish\win-x64\DevTools.exe -NewName DevTools-win-x64.exe
Rename-Item -Path publish\win-arm64\DevTools.exe -NewName DevTools-win-arm64.exe
- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: DevTools v${{ steps.get_version.outputs.VERSION }}
body: ${{ steps.changelog.outputs.CONTENT }}
files: |
publish/win-x86/DevTools-win-x86.exe
publish/win-x64/DevTools-win-x64.exe
publish/win-arm64/DevTools-win-arm64.exe
installer/*.exe
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}