add Win+R execution support and centralize registry paths #66
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' | |
| - 'assets/icon.ico' | |
| workflow_dispatch: | |
| inputs: | |
| make_release: | |
| description: 'Create a Release?' | |
| required: true | |
| type: boolean | |
| default: false | |
| 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: Upload Build Artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: QuickRotate-${{ env.APP_VERSION }} | |
| path: QuickRotate.exe | |
| retention-days: 7 | |
| - name: Generate Release Notes | |
| if: (github.event_name == 'push' && contains(github.event.head_commit.message, '[release]')) || (github.event_name == 'workflow_dispatch' && inputs.make_release == true) | |
| 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 = @" | |
| # <sub>[<img src="./assets/icon.png" width="40" height="40">](https://github.com/$repo/releases/latest)</sub> Quick Rotate v$ver | |
| --- | |
| - **Build Date:** ``${{ env.BUILD_DATE }}`` | |
| - **Build Time:** ``${{ env.BUILD_TIME }}`` | |
| - **File Size:** ``$sizeKB`` | |
| - **VirusTotal:** [``Security Report``]($vt_url) | |
| --- | |
| ### 📥 Install & Update Options | |
| * **Direct Download (Latest) ⚡** | |
| <a href="https://github.com/$repo/releases/download/v$ver/$file"><img alt="Direct Download .exe" width="200px" src="https://github.com/$repo/blob/main/assets/github-button.svg?raw=true" /></a> | |
| > [!IMPORTANT] | |
| > **Heads up:** It takes a little while for the **``Microsoft Store``** and **``WinGet``** to review and publish new updates. If you don't want to wait, grab the **``Direct Download``** above to get it right now! 😉 | |
| * **Microsoft Store**<br> | |
| <a href="https://aka.ms/AA132927"><img alt="Get it from Microsoft" width="200" src="https://get.microsoft.com/images/en-us%20dark.svg" /></a> | |
| * **WinGet CLI** | |
| ``````powershell | |
| winget install QuickRotate # Install | |
| winget upgrade QuickRotate # Update | |
| `````` | |
| --- | |
| ### 🔒 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 | |
| if: (github.event_name == 'push' && contains(github.event.head_commit.message, '[release]')) || (github.event_name == 'workflow_dispatch' && inputs.make_release == true) | |
| 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 |