feat: update version to 3.1.1-dev.0 #21
Workflow file for this run
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
name: Build and Publish Debug Version | |
on: | |
push: | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+-dev.[0-9]+" | |
- "v[0-9]+.[0-9]+.[0-9]+-dev" | |
env: | |
PATH_TO_PROJECTS: ${{ github.workspace }}\src | |
PACKAGE_OUTPUT_DIRECTORY: ${{ github.workspace }}\output\ | |
NUGET_SOURCE_URL: 'https://api.nuget.org/v3/index.json' | |
GITHUB_PACKAGES_URL: 'https://nuget.pkg.github.com/asv-soft/index.json' | |
PROPS_VERSION_VAR_NAME: 'ProductVersion' | |
jobs: | |
deploy: | |
name: 'Deploy' | |
runs-on: windows-2019 | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: 'Checkout' | |
uses: actions/checkout@v4 | |
- name: Setup .Net | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
8.x.x | |
- name: Set version variable | |
env: | |
TAG: ${{ github.event.inputs.tag }} | |
shell: pwsh | |
run: | | |
$newTag = "${{ github.ref_name }}".TrimStart("v") | |
echo "VERSION=$newTag" | Out-File -FilePath $env:GITHUB_ENV -Append | |
- name: Read version from Directory.Build.props | |
shell: pwsh | |
run: | | |
$propsVersionVarName = '${{ env.PROPS_VERSION_VAR_NAME }}' | |
$directoryBuildPropsPath = '${{ env.PATH_TO_PROJECTS }}/Directory.Build.props' | |
$versionRegex = "<$propsVersionVarName>([^<]+)" | |
$versionMatch = Select-String -Path $directoryBuildPropsPath -Pattern $versionRegex | ForEach-Object { $_.Matches[0].Groups[1].Value } | |
Add-Content -Path $env:GITHUB_ENV -Value "PropsVersion=$versionMatch" | |
- name: Compare tag with NuGet package version | |
shell: pwsh | |
run: | | |
if ("${{ env.PropsVersion }}" -ne "${{ env.VERSION }}") { | |
Write-Host "Error: Tag does not match NuGet package version" | |
exit 1 | |
} | |
- name: Check version | |
run: echo ${{ env.VERSION }} | |
- name: Set project version | |
run: | | |
dotnet tool install -g dotnet-setversion | |
setversion ${{ env.VERSION }} ${{ env.PATH_TO_PROJECTS }}\Asv.Cfg\Asv.Cfg.csproj | |
setversion ${{ env.VERSION }} ${{ env.PATH_TO_PROJECTS }}\Asv.Common\Asv.Common.csproj | |
setversion ${{ env.VERSION }} ${{ env.PATH_TO_PROJECTS }}\Asv.IO\Asv.IO.csproj | |
setversion ${{ env.VERSION }} ${{ env.PATH_TO_PROJECTS }}\Asv.Composition\Asv.Composition.csproj | |
- name: Add NuGet source | |
run: | | |
dotnet nuget add source ${{ env.GITHUB_PACKAGES_URL }} --username '${{ secrets.USER_NAME }}' --password '${{ secrets.GIHUB_NUGET_AUTH_TOKEN }}' --store-password-in-clear-text | |
- name: Restore dependencies | |
run: | | |
cd src | |
dotnet restore | |
- name: Build projects | |
run: | | |
cd src | |
dotnet build -c Release --no-restore | |
- name: Running all tests | |
run: | | |
cd src | |
dotnet test --no-restore --verbosity normal | |
- name: Pack projects to Nuget | |
run: | | |
cd src | |
dotnet pack -c Release --no-build --no-restore -p:PackageVersion=${{ env.VERSION }} --output ${{ env.PACKAGE_OUTPUT_DIRECTORY }} | |
- name: Push packages to Github | |
run: | | |
cd src | |
dotnet nuget push ${{ env.PACKAGE_OUTPUT_DIRECTORY }}Asv.Cfg.${{ env.VERSION }}.nupkg -k ${{ secrets.GIHUB_NUGET_AUTH_TOKEN }} -s ${{ env.GITHUB_PACKAGES_URL }} | |
dotnet nuget push ${{ env.PACKAGE_OUTPUT_DIRECTORY }}Asv.Common.${{ env.VERSION }}.nupkg -k ${{ secrets.GIHUB_NUGET_AUTH_TOKEN }} -s ${{ env.GITHUB_PACKAGES_URL }} | |
dotnet nuget push ${{ env.PACKAGE_OUTPUT_DIRECTORY }}Asv.IO.${{ env.VERSION }}.nupkg -k ${{ secrets.GIHUB_NUGET_AUTH_TOKEN }} -s ${{ env.GITHUB_PACKAGES_URL }} | |
dotnet nuget push ${{ env.PACKAGE_OUTPUT_DIRECTORY }}Asv.Composition.${{ env.VERSION }}.nupkg -k ${{ secrets.GIHUB_NUGET_AUTH_TOKEN }} -s ${{ env.GITHUB_PACKAGES_URL }} |