Add output of modified csproj file #71
This file contains 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
# This workflow will build a .NET project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
name: .NET | |
on: | |
push: | |
branches: ["main", "initial"] | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Clean nuget packages | |
run: | | |
$packages = gci -r -fi *.nupkg | |
echo "Found packages: $packages" | |
foreach ($package in $packages) | |
{ | |
Write-Host "Removing package: $package" | |
Remove-Item $package.FullName | |
} | |
- name: Restore dependencies | |
run: dotnet restore .\Tilde.Translation\Tilde.Translation.csproj | |
- name: Update build version | |
run: | | |
$PROJECT_FILE=".\Tilde.Translation\Tilde.Translation.csproj" | |
$BUILD_NUMBER="${{github.run_number}}" | |
echo "Build number: $BUILD_NUMBER" | |
(Get-Content -Path $PROJECT_FILE) -replace "(?<=<Version>)(\d+\.\d+\.\d+\.)(\d+)(?=</Version>)", "`$1$BUILD_NUMBER" | Set-Content -Path $PROJECT_FILE | |
# TMP output | |
cat $PROJECT_FILE | |
- name: Build app for release | |
run: msbuild Tilde.Translation\Tilde.Translation.csproj -t:rebuild -property:Configuration=Release | |
- name: Publish to private nuget repo | |
run: | | |
gci -r -fi *.nupkg | |
$NUGET_PACKAGE_PATH=gci -r -fi *.nupkg | % { $_.FullName } | |
echo "Nuget package path: $NUGET_PACKAGE_PATH" | |
dotnet nuget push $NUGET_PACKAGE_PATH --api-key ${{ secrets.NUGET_PAT }} --source https://api.nuget.org/v3/index.json --skip-duplicate |