Build QuickRotate #48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build QuickRotate | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'version.h' | |
| - 'QuickRotate.cpp' | |
| - 'QuickRotate.rc' | |
| - 'icon.ico' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-release: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v6 | |
| - name: Set up MSYS2 | |
| uses: msys2/setup-msys2@v2 | |
| with: | |
| msystem: MINGW32 | |
| install: mingw-w64-i686-gcc | |
| update: true | |
| - name: Compile Resources | |
| shell: msys2 {0} | |
| run: windres QuickRotate.rc -O coff -o QuickRotate_res.o | |
| - name: Compile QuickRotate Exe | |
| shell: msys2 {0} | |
| run: | | |
| g++ QuickRotate.cpp QuickRotate_res.o -o QuickRotate.exe -static -nostartfiles -e _WinMain@16 -Os -s -fno-exceptions -fno-rtti -fno-stack-protector -fomit-frame-pointer "-Wl,--gc-sections" -lgdi32 -luser32 -lgdiplus -lshlwapi -lshell32 -lole32 -luuid -ladvapi32 -mwindows | |
| - name: Restore Signing Certificate | |
| shell: pwsh | |
| env: | |
| CERT_BASE64: ${{ secrets.SIGNING_CERT }} | |
| run: | | |
| $certBytes = [System.Convert]::FromBase64String($env:CERT_BASE64) | |
| [System.IO.File]::WriteAllBytes("certificate.pfx", $certBytes) | |
| - name: Sign QuickRotate | |
| shell: pwsh | |
| env: | |
| CERT_PASS: ${{ secrets.SIGNING_PASS }} | |
| run: | | |
| $signtool = Get-ChildItem -Path "C:\Program Files (x86)\Windows Kits" -Recurse -Filter "signtool.exe" | Select-Object -First 1 | |
| if (-not $signtool) { Write-Error "Signtool not found!"; exit 1 } | |
| & $signtool.FullName sign /f "certificate.pfx" /p "$env:CERT_PASS" /fd SHA256 /d "Quick Rotate by ArKT-7" /du "https://github.com/ArKT-7" /tr http://timestamp.digicert.com /td sha256 "QuickRotate.exe" | |
| Remove-Item "certificate.pfx" -Force | |
| - name: VirusTotal Scan | |
| id: vt | |
| uses: crazy-max/ghaction-virustotal@v5 | |
| with: | |
| vt_api_key: ${{ secrets.VT_API_KEY }} | |
| files: QuickRotate.exe | |
| - name: Get Version & Date | |
| id: info | |
| shell: pwsh | |
| run: | | |
| $verLine = Get-Content version.h | Select-String "VERSION_STR" | Select-Object -First 1 | |
| $version = $verLine.ToString().Split('"')[1] | |
| echo "APP_VERSION=$version" >> $env:GITHUB_ENV | |
| $date = (Get-Date).ToUniversalTime().ToString("d MMMM yyyy") | |
| $time = (Get-Date).ToUniversalTime().ToString("HH:mm 'UTC'") | |
| echo "BUILD_DATE=$date" >> $env:GITHUB_ENV | |
| echo "BUILD_TIME=$time" >> $env:GITHUB_ENV | |
| - name: Generate Release Notes | |
| shell: pwsh | |
| run: | | |
| $repo = "${{ github.repository }}" | |
| $ver = "${{ env.APP_VERSION }}" | |
| $file = "QuickRotate.exe" | |
| $sizeBytes = (Get-Item $file).Length | |
| $sizeKB = "{0:N2} KB" -f ($sizeBytes / 1KB) | |
| $md5 = (Get-FileHash $file -Algorithm MD5).Hash | |
| $sha1 = (Get-FileHash $file -Algorithm SHA1).Hash | |
| $sha256 = (Get-FileHash $file -Algorithm SHA256).Hash | |
| $raw_vt = "${{ steps.vt.outputs.analysis }}" | |
| if ($raw_vt.Contains('=')) { | |
| $vt_url = $raw_vt.Substring($raw_vt.IndexOf('=') + 1) | |
| } else { | |
| $vt_url = $raw_vt | |
| } | |
| $body = @" | |
| # ⚡ Quick Rotate v$ver | |
| --- | |
| - **Build Date:** ``${{ env.BUILD_DATE }}`` | |
| - **Build Time:** ``${{ env.BUILD_TIME }}`` | |
| - **File Size:** ``$sizeKB`` | |
| - **VirusTotal:** [``Security Report``]($vt_url) | |
| --- | |
| ## <a href="https://github.com/$repo/releases/download/v$ver/$file"><img src="https://github.com/$repo/blob/main/icon.ico" width="36" height="36" align="absmiddle"></a> [``Download Quick Rotate``](https://github.com/$repo/releases/download/v$ver/$file) | |
| --- | |
| ### 🔒 Integrity Checksums | |
| | Algorithm | Hash | | |
| | :--- | :--- | | |
| | **MD5** | ``$md5`` | | |
| | **SHA-1** | ``$sha1`` | | |
| | **SHA-256** | ``$sha256`` | | |
| --- | |
| ### [``📖 View Readme & Usage Guide 🙂↔️``](https://github.com/$repo/blob/main/README.md#-usage-guide) | |
| --- | |
| "@ | |
| [System.IO.File]::WriteAllText("release_notes.md", $body) | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| tag_name: v${{ env.APP_VERSION }} | |
| name: Quick Rotate v${{ env.APP_VERSION }} | |
| body_path: release_notes.md | |
| files: | | |
| QuickRotate.exe |