Delete MulderConfig before download #171
Workflow file for this run
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: nsis | |
| # Avoid concurrent runs of this workflow on the main branch, but allow them for PRs | |
| concurrency: | |
| group: ${{ github.workflow }}-main | |
| cancel-in-progress: ${{ github.ref == 'refs/heads/main' }} | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - pre/** | |
| pull_request: {} | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Find previous release | |
| id: previous_release | |
| shell: pwsh | |
| run: | | |
| $tag = git describe --tags --abbrev=0 2>$null | |
| if (-not $tag) { | |
| Write-Host "No previous release found, using first commit" | |
| $firstCommit = git rev-list --max-parents=0 HEAD | |
| echo fromCommit=$firstCommit >> $env:GITHUB_OUTPUT | |
| } else { | |
| Write-Host "Previous release tag: $tag" | |
| echo fromCommit=$tag >> $env:GITHUB_OUTPUT | |
| } | |
| - name: Detect NSI files to build | |
| id: detect | |
| shell: pwsh | |
| run: | | |
| $fromCommit = "${{ steps.previous_release.outputs.fromCommit }}" | |
| .\detect.ps1 $fromCommit HEAD | |
| working-directory: build | |
| - name: Setup build tools | |
| if: steps.detect.outputs.detectSummary != 'none' | |
| shell: pwsh | |
| env: | |
| CERTIFICATE_BASE64: ${{ secrets.CERTIFICATE_BASE64 }} | |
| run: .\setup.ps1 | |
| working-directory: build | |
| - name: Build NSI files | |
| if: steps.detect.outputs.detectSummary != 'none' | |
| shell: pwsh | |
| env: | |
| CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }} | |
| ENABLE_CODE_SIGNING: ${{ vars.ENABLE_CODE_SIGNING }} | |
| MULDERLOAD_CDN_KEY: ${{ secrets.MULDERLOAD_CDN_KEY }} | |
| MULDERLOAD_REDIRECT_KEY: ${{ secrets.MULDERLOAD_REDIRECT_KEY }} | |
| run: | | |
| Get-Content detect_result.txt | ForEach-Object { | |
| Write-Host " // Building $_" | |
| if ($env:ENABLE_CODE_SIGNING -eq "true") { | |
| .\make.ps1 $_ -sign | |
| } else { | |
| .\make.ps1 $_ | |
| } | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Error "❌ Build failed for: $_ (exit code: $LASTEXITCODE)" | |
| exit 1 | |
| } | |
| } | |
| working-directory: build | |
| - name: Generate version number | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/pre/')) && steps.detect.outputs.detectSummary != 'none' | |
| id: version_number | |
| shell: pwsh | |
| run: | | |
| $isPre = "${{ github.ref_name }}" -ne "main" | |
| if ($isPre) { | |
| $base = Get-Date -Format "yy.00" | |
| } else { | |
| $base = Get-Date -Format "yy.MM" | |
| } | |
| $tagPattern = "$base.*" | |
| $tagRegex = '^\d+\.\d+\.(\d+)$' | |
| $tags = git tag -l "$tagPattern" | |
| Write-Host "Matching tags: $($tags -join ', ')" | |
| if ($tags) { | |
| $last = $tags | ForEach-Object { | |
| if ($_ -match $tagRegex) { [int]$Matches[1] } else { 0 } | |
| } | Sort-Object -Descending | Select-Object -First 1 | |
| $next = [int]$last + 1 | |
| } else { | |
| $next = 1 | |
| } | |
| $versionNumber = "$base.$next" | |
| Write-Host "Generated version number: $versionNumber" | |
| echo versionNumber=$versionNumber >> $env:GITHUB_OUTPUT | |
| echo isPre=$($isPre.ToString().ToLower()) >> $env:GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/pre/')) && steps.detect.outputs.detectSummary != 'none' | |
| shell: pwsh | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| $versionNumber = "${{ steps.version_number.outputs.versionNumber }}" | |
| $detectSummary = "${{ steps.detect.outputs.detectSummary }}" | |
| $isPre = "${{ steps.version_number.outputs.isPre }}" -eq "true" | |
| if ($isPre) { | |
| gh release create $versionNumber ../dist/*.exe --generate-notes --prerelease | |
| } elseif ($detectSummary -eq "partial") { | |
| gh release create $versionNumber ../dist/*.exe --generate-notes | |
| } else { | |
| gh release create $versionNumber ../dist/*.exe --generate-notes --latest=false | |
| } | |
| working-directory: build | |
| - name: Cleanup old pre-releases | |
| if: steps.version_number.outputs.isPre == 'true' | |
| shell: pwsh | |
| run: | | |
| $old = gh release list --limit 100 --json tagName,isPrerelease,createdAt | | |
| ConvertFrom-Json | | |
| Where-Object { $_.isPrerelease } | | |
| Sort-Object createdAt | | |
| Select-Object -SkipLast 10 | |
| foreach ($r in $old) { | |
| Write-Host "Deleting old pre-release: $($r.tagName)" | |
| gh release delete $r.tagName --cleanup-tag --yes | |
| } | |
| env: | |
| GH_TOKEN: ${{ github.token }} |