docs(CHANGELOG): v0.4.1 #67
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: Build and Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| jobs: | |
| build-windows: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Enable long paths in git | |
| run: git config --global core.longpaths true | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: true | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 10.0.x | |
| dotnet-quality: 'preview' | |
| - name: Setup MSBuild | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Get version from tag | |
| id: get_version | |
| shell: pwsh | |
| run: | | |
| $version = $env:GITHUB_REF -replace 'refs/tags/v', '' | |
| echo "VERSION=$version" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Extract Release Notes from CHANGELOG.md | |
| id: get_release_notes | |
| shell: pwsh | |
| run: | | |
| $changelog = Get-Content -Path CHANGELOG.md -Raw | |
| $version = "${{ env.VERSION }}" | |
| # Use regex to match the content from the current version's header | |
| # to the next version's header or the end of the file. | |
| # (?s) makes . match newlines, (?m) makes ^ match the start of a line. | |
| $pattern = "(?sm)(^##\s+\[v$([regex]::Escape($version))\].*?)(?=^##\s+\[v|\z)" | |
| $match = [regex]::Match($changelog, $pattern) | |
| if (-not $match.Success) { | |
| Write-Error "Could not find release notes for v${version} in CHANGELOG.md" | |
| exit 1 | |
| } | |
| # Remove the first line (the version header) | |
| $releaseBody = $match.Value.Split([System.Environment]::NewLine, 2)[1].Trim() | |
| # Set the multi-line output for the step | |
| $delimiter = "EOF_$(Get-Random)" | |
| echo "body<<$delimiter" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
| echo $releaseBody | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
| echo "$delimiter" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
| - name: Restore | |
| shell: pwsh | |
| run: | | |
| dotnet restore Everywhere.sln -r win-x64 | |
| - name: Publish Everywhere.Windows | |
| shell: pwsh | |
| run: | | |
| dotnet publish src/Everywhere.Windows/Everywhere.Windows.csproj -c Release --self-contained true -p:AssemblyVersion=$env:VERSION -p:FileVersion=$env:VERSION -o ./publish --no-restore | |
| - name: Install Inno Setup | |
| shell: pwsh | |
| run: | | |
| choco install innosetup | |
| - name: Compile .ISS to .EXE Installer | |
| shell: pwsh | |
| run: | | |
| & "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" "tools/installer.iss" /O+ | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Error "Inno Setup compilation failed with exit code $LASTEXITCODE" | |
| exit $LASTEXITCODE | |
| } | |
| - name: Create release zip | |
| shell: pwsh | |
| run: | | |
| Compress-Archive -Path ./publish/* -DestinationPath ./Everywhere-Windows-x64-v$env:VERSION.zip | |
| - name: Create GitHub Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: Everywhere v${{env.VERSION}} | |
| body: ${{ steps.get_release_notes.outputs.body }} | |
| draft: false | |
| prerelease: false | |
| files: | | |
| ./Everywhere-Windows-x64-v${{env.VERSION}}.zip | |
| ./Everywhere-Windows-x64-Setup-v${{env.VERSION}}.exe |