Update build version #77
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: 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.${3}" | Set-Content -Path $PROJECT_FILE | |
# TMP output | |
cat $PROJECT_FILE | |
- name: Restore dependencies | |
run: dotnet restore .\Tilde.Translation\Tilde.Translation.csproj | |
- name: Build app for release | |
run: msbuild Tilde.Translation\Tilde.Translation.csproj -t:rebuild -property:Configuration=Release | |
- name: Publish to private nuget repo | |
run: | | |
cat ".\Tilde.Translation\Tilde.Translation.csproj" | |
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 |