|
| 1 | +name: Build & Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [master] |
| 6 | + tags: ['v*'] |
| 7 | + pull_request: |
| 8 | + branches: [master] |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: write # needed to create releases |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + runs-on: windows-latest |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout |
| 20 | + uses: actions/checkout@v4 |
| 21 | + |
| 22 | + # ── CUDA ────────────────────────────────────────────────────────────── |
| 23 | + - name: Install CUDA Toolkit 12.6 |
| 24 | + uses: Jimver/cuda-toolkit@v0.2.19 |
| 25 | + with: |
| 26 | + cuda: '12.6.0' |
| 27 | + method: 'network' |
| 28 | + sub-packages: '["nvcc", "visual_studio_integration"]' |
| 29 | + |
| 30 | + # ── DSD-FME runtime (gitignored — download fresh each run) ──────────── |
| 31 | + - name: Cache DSD-FME runtime |
| 32 | + id: cache-dsd |
| 33 | + uses: actions/cache@v4 |
| 34 | + with: |
| 35 | + path: tools |
| 36 | + key: dsd-fme-portable-20251214 |
| 37 | + |
| 38 | + - name: Download DSD-FME runtime |
| 39 | + if: steps.cache-dsd.outputs.cache-hit != 'true' |
| 40 | + shell: pwsh |
| 41 | + run: | |
| 42 | + $url = "https://github.com/lwvmobile/dsd-fme/releases/download/v1.8-OHIO/dsd-fme-portable-win64-20251214.zip" |
| 43 | + $tmp = "$env:RUNNER_TEMP\dsd-fme.zip" |
| 44 | + Write-Host "Downloading DSD-FME portable..." |
| 45 | + Invoke-WebRequest -Uri $url -OutFile $tmp -UseBasicParsing |
| 46 | + Write-Host "Extracting..." |
| 47 | + Add-Type -AssemblyName System.IO.Compression.FileSystem |
| 48 | + $z = [IO.Compression.ZipFile]::OpenRead($tmp) |
| 49 | + foreach ($e in $z.Entries) { |
| 50 | + if ($e.FullName -match '^dsd-fme/[^/]+$' -and $e.Name -match '\.(dll|exe)$') { |
| 51 | + [IO.Compression.ZipFileExtensions]::ExtractToFile($e, "tools\$($e.Name)", $true) |
| 52 | + } |
| 53 | + } |
| 54 | + $z.Dispose() |
| 55 | + Remove-Item $tmp |
| 56 | + Write-Host "Done. $(Get-ChildItem tools\*.dll | Measure-Object).Count DLLs extracted." |
| 57 | +
|
| 58 | + # ── Build application ───────────────────────────────────────────────── |
| 59 | + - name: Build dmrcrack.exe |
| 60 | + shell: cmd |
| 61 | + run: | |
| 62 | + if not exist bin mkdir bin |
| 63 | + call build.bat |
| 64 | + if errorlevel 1 exit /b 1 |
| 65 | +
|
| 66 | + # ── Installer ───────────────────────────────────────────────────────── |
| 67 | + - name: Install Inno Setup |
| 68 | + shell: pwsh |
| 69 | + run: choco install innosetup --yes --no-progress |
| 70 | + |
| 71 | + - name: Build installer |
| 72 | + shell: cmd |
| 73 | + run: '"%ProgramFiles(x86)%\Inno Setup 6\ISCC.exe" installer\FSP.DMRCrack.iss' |
| 74 | + |
| 75 | + # ── Artifacts ───────────────────────────────────────────────────────── |
| 76 | + - name: Upload installer artifact |
| 77 | + uses: actions/upload-artifact@v4 |
| 78 | + with: |
| 79 | + name: FSP.DMRCrack-installer |
| 80 | + path: installer\output\*.exe |
| 81 | + retention-days: 30 |
| 82 | + |
| 83 | + # ── Release (only on version tags: v0.1.0, v1.2.3, etc.) ───────────── |
| 84 | + - name: Create GitHub Release |
| 85 | + if: startsWith(github.ref, 'refs/tags/v') |
| 86 | + uses: softprops/action-gh-release@v2 |
| 87 | + with: |
| 88 | + files: installer\output\*.exe |
| 89 | + generate_release_notes: true |
| 90 | + fail_on_unmatched_files: true |
0 commit comments