|
| 1 | +name: Build and Release (Deprecated) |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +# DEPRECATED: This workflow has been merged into release.yml |
| 7 | +# release.yml handles both installers and MSIX packages in a unified release process |
| 8 | + |
| 9 | +jobs: |
| 10 | + build-and-release: |
| 11 | + runs-on: windows-latest |
| 12 | + |
| 13 | + steps: |
| 14 | + - name: Checkout |
| 15 | + uses: actions/checkout@v4 |
| 16 | + |
| 17 | + - name: Setup .NET |
| 18 | + uses: actions/setup-dotnet@v3 |
| 19 | + with: |
| 20 | + dotnet-version: '8.0.x' |
| 21 | + |
| 22 | + - name: Get version from tag |
| 23 | + id: get_version |
| 24 | + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT |
| 25 | + shell: bash |
| 26 | + |
| 27 | + - name: Extract latest changelog |
| 28 | + id: changelog |
| 29 | + run: | |
| 30 | + $content = Get-Content CHANGELOG.md -Raw |
| 31 | + $pattern = '(?s)(## \[.*?\].*?)(?=\n---|\Z)' |
| 32 | + if ($content -match $pattern) { |
| 33 | + $latest = $matches[1].Trim() |
| 34 | + echo "CONTENT<<EOF" >> $env:GITHUB_OUTPUT |
| 35 | + echo "$latest" >> $env:GITHUB_OUTPUT |
| 36 | + echo "EOF" >> $env:GITHUB_OUTPUT |
| 37 | + } |
| 38 | + shell: pwsh |
| 39 | + |
| 40 | + - name: Restore |
| 41 | + run: dotnet restore DevTools.csproj |
| 42 | + |
| 43 | + - name: Publish win-x86 |
| 44 | + 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 |
| 45 | + |
| 46 | + - name: Publish win-x64 |
| 47 | + 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 |
| 48 | + |
| 49 | + - name: Publish win-arm64 |
| 50 | + 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 |
| 51 | + |
| 52 | + - name: Decode signing certificate |
| 53 | + if: env.CERTIFICATE_BASE64 != '' |
| 54 | + env: |
| 55 | + CERTIFICATE_BASE64: ${{ secrets.CERTIFICATE_BASE64 }} |
| 56 | + run: | |
| 57 | + $certPath = Join-Path $env:RUNNER_TEMP "cert.pfx" |
| 58 | + [System.IO.File]::WriteAllBytes($certPath, [System.Convert]::FromBase64String($env:CERTIFICATE_BASE64)) |
| 59 | + echo "CERT_PATH=$certPath" >> $env:GITHUB_ENV |
| 60 | + shell: pwsh |
| 61 | + |
| 62 | + - name: Sign executables |
| 63 | + if: env.CERT_PATH != '' |
| 64 | + env: |
| 65 | + CERT_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }} |
| 66 | + run: | |
| 67 | + $signtool = Get-ChildItem -Path "${env:ProgramFiles(x86)}\Windows Kits\10\bin\*\x64\signtool.exe" | Sort-Object { $_.VersionInfo.FileVersion } -Descending | Select-Object -First 1 |
| 68 | + |
| 69 | + $exeFiles = @( |
| 70 | + "publish\win-x86\DevTools.exe", |
| 71 | + "publish\win-x64\DevTools.exe", |
| 72 | + "publish\win-arm64\DevTools.exe" |
| 73 | + ) |
| 74 | + |
| 75 | + foreach ($exe in $exeFiles) { |
| 76 | + Write-Host "Signing: $exe" |
| 77 | + & $signtool.FullName sign /f $env:CERT_PATH /p $env:CERT_PASSWORD /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 $exe |
| 78 | + if ($LASTEXITCODE -ne 0) { |
| 79 | + Write-Host "Warning: Failed to sign $exe" |
| 80 | + } |
| 81 | + } |
| 82 | + shell: pwsh |
| 83 | + |
| 84 | + - name: Install Inno Setup |
| 85 | + run: | |
| 86 | + choco install innosetup -y |
| 87 | + shell: pwsh |
| 88 | + |
| 89 | + - name: Download Chinese language file for Inno Setup |
| 90 | + run: | |
| 91 | + $innoPath = "${env:ProgramFiles(x86)}\Inno Setup 6" |
| 92 | + $langPath = Join-Path $innoPath "Languages" |
| 93 | + $chineseFile = Join-Path $langPath "ChineseSimplified.isl" |
| 94 | + |
| 95 | + if (-not (Test-Path $chineseFile)) { |
| 96 | + Write-Host "Downloading Chinese Simplified language file..." |
| 97 | + Invoke-WebRequest -Uri "https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/ChineseSimplified.isl" -OutFile $chineseFile |
| 98 | + } |
| 99 | + shell: pwsh |
| 100 | + |
| 101 | + - name: Build Installers |
| 102 | + run: | |
| 103 | + New-Item -ItemType Directory -Force -Path installer |
| 104 | + |
| 105 | + $version = "${{ steps.get_version.outputs.VERSION }}" |
| 106 | + $rootDir = $PWD.Path |
| 107 | + |
| 108 | + Write-Host "Building x64 installer..." |
| 109 | + & iscc "$rootDir\scripts\installer.iss" /DAppVersion="$version" /DArchitecture="x64" /DOutputDir="$rootDir\installer" /DSourceDir="$rootDir\publish\win-x64" |
| 110 | + |
| 111 | + Write-Host "Building x86 installer..." |
| 112 | + & iscc "$rootDir\scripts\installer.iss" /DAppVersion="$version" /DArchitecture="x86" /DOutputDir="$rootDir\installer" /DSourceDir="$rootDir\publish\win-x86" |
| 113 | + |
| 114 | + Write-Host "Building arm64 installer..." |
| 115 | + & iscc "$rootDir\scripts\installer.iss" /DAppVersion="$version" /DArchitecture="arm64" /DOutputDir="$rootDir\installer" /DSourceDir="$rootDir\publish\win-arm64" |
| 116 | + shell: pwsh |
| 117 | + |
| 118 | + - name: Sign installers |
| 119 | + if: env.CERT_PATH != '' |
| 120 | + env: |
| 121 | + CERT_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }} |
| 122 | + run: | |
| 123 | + $signtool = Get-ChildItem -Path "${env:ProgramFiles(x86)}\Windows Kits\10\bin\*\x64\signtool.exe" | Sort-Object { $_.VersionInfo.FileVersion } -Descending | Select-Object -First 1 |
| 124 | + |
| 125 | + $installerFiles = Get-ChildItem -Path "installer\*.exe" |
| 126 | + |
| 127 | + foreach ($installer in $installerFiles) { |
| 128 | + Write-Host "Signing: $($installer.FullName)" |
| 129 | + & $signtool.FullName sign /f $env:CERT_PATH /p $env:CERT_PASSWORD /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 $installer.FullName |
| 130 | + if ($LASTEXITCODE -ne 0) { |
| 131 | + Write-Host "Warning: Failed to sign $($installer.FullName)" |
| 132 | + } |
| 133 | + } |
| 134 | + shell: pwsh |
| 135 | + |
| 136 | + - name: Rename executables |
| 137 | + run: | |
| 138 | + Rename-Item -Path publish\win-x86\DevTools.exe -NewName DevTools-win-x86.exe |
| 139 | + Rename-Item -Path publish\win-x64\DevTools.exe -NewName DevTools-win-x64.exe |
| 140 | + Rename-Item -Path publish\win-arm64\DevTools.exe -NewName DevTools-win-arm64.exe |
| 141 | +
|
| 142 | + - name: Create Release |
| 143 | + uses: softprops/action-gh-release@v1 |
| 144 | + with: |
| 145 | + name: DevTools v${{ steps.get_version.outputs.VERSION }} |
| 146 | + body: ${{ steps.changelog.outputs.CONTENT }} |
| 147 | + files: | |
| 148 | + publish/win-x86/DevTools-win-x86.exe |
| 149 | + publish/win-x64/DevTools-win-x64.exe |
| 150 | + publish/win-arm64/DevTools-win-arm64.exe |
| 151 | + installer/*.exe |
| 152 | + env: |
| 153 | + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
0 commit comments