name: CI on: push: branches: ["**"] tags: ["v*"] pull_request: workflow_dispatch: concurrency: group: ci-${{ github.ref }} cancel-in-progress: true permissions: contents: read jobs: build: name: Build runs-on: windows-latest permissions: contents: write # publish release on tag steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable - uses: Swatinem/rust-cache@v2 - name: Resolve version id: meta shell: pwsh run: | if ($env:GITHUB_REF -like 'refs/tags/v*') { $version = $env:GITHUB_REF_NAME -replace '^v', '' } else { $version = (Select-String -Path Cargo.toml -Pattern '^version\s*=\s*"([^"]+)"' | Select-Object -First 1).Matches[0].Groups[1].Value } "version=$version" >> $env:GITHUB_OUTPUT Write-Host "version: $version" - name: Build run: cargo build --release --locked # Install unconditionally: the script uses ArchitecturesAllowed=x64compatible, # which needs Inno Setup 6.3+. The version in the runner image is not guaranteed. - name: Install Inno Setup shell: pwsh run: choco install innosetup --no-progress -y - name: Build installer shell: pwsh run: | $iscc = Get-ChildItem -ErrorAction SilentlyContinue -Path @( "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe", "${env:ProgramFiles}\Inno Setup 6\ISCC.exe" ) | Select-Object -First 1 if (-not $iscc) { throw "ISCC.exe not found" } New-Item -ItemType Directory -Force -Path dist | Out-Null Copy-Item target\release\syshelper.exe dist\ & $iscc.FullName /DAppVersion=${{ steps.meta.outputs.version }} installer\setup.iss if ($LASTEXITCODE -ne 0) { throw "ISCC exited with $LASTEXITCODE" } Get-ChildItem dist | Format-Table Name, Length - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: syshelper-${{ steps.meta.outputs.version }}-windows-x64 path: dist/*.exe if-no-files-found: error retention-days: 30 - name: Publish release if: startsWith(github.ref, 'refs/tags/v') shell: pwsh env: GH_TOKEN: ${{ github.token }} run: | $files = (Get-ChildItem dist\*.exe).FullName gh release create $env:GITHUB_REF_NAME $files --generate-notes