name: Dotnet Build on: [push] jobs: build: runs-on: win11 steps: - name: Checkout code uses: actions/checkout@v4 - name: MSBuild version run: | msbuild -version - name: Extract project version run: | $version = Select-String -Path "WeeXnes/WeeXnes.csproj" -Pattern "(.+?)" | ForEach-Object { ($_ -match "(.+?)") | Out-Null $matches[1] } Write-Output "Version extracted: $version" "PROJECT_VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding ASCII -Append - name: Test exported version variable run: | Write-Output "The extracted project version is: $env:PROJECT_VERSION" if (-not $env:PROJECT_VERSION) { Write-Error "PROJECT_VERSION variable is not set!" exit 1 } - name: Restore Packages run: nuget restore WeeXnes.sln - name: Build Solution run: | msbuild WeeXnes.sln /p:DeleteExistingFiles=True /p:platform="Any CPU" /p:configuration="Release" - name: Packing Zip run: | $zipName = "currentRelease_$env:PROJECT_VERSION.zip" Compress-Archive -Path ` WeeXnes\bin\Release\WeeXnes.exe, ` WeeXnes\bin\Release\System.Drawing.Common.dll, ` WeeXnes\bin\Release\Wpf.Ui.dll, ` WeeXnes_UAC\bin\Release\WeeXnes_UAC.exe, ` WeeXnes\bin\Release\DiscordRPC.dll, ` WeeXnes\bin\Release\Newtonsoft.Json.dll, ` Autostart\bin\Release\Autostart.exe, ` WXPlugin\bin\Release\WXPlugin.dll, ` Update\bin\Release\Update.exe ` -CompressionLevel Optimal ` -DestinationPath $zipName Write-Output "Created zip: $zipName" - name: Prepare release directory run: | mkdir release move currentRelease_$env:PROJECT_VERSION.zip release\ - name: Create Git tag run: | git config user.name "WeeXnes" git config user.email "weexnes@weexnes.dev" git tag v$env:PROJECT_VERSION git push origin v$env:PROJECT_VERSION - name: Upload to Forgejo uses: actions/forgejo-release@v2.6.0 with: direction: upload url: https://git.weexnes.dev/ repo: WeeXnes/Cryptura token: ${{ secrets.RELEASE_TOKEN }} tag: v${{ steps.get_version.outputs.version }} release-dir: release release-notes: "Automated release for version ${{ steps.get_version.outputs.version }}"