Skip to content

Commit

Permalink
check version command in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
sensslen committed Jan 16, 2024
1 parent 9328185 commit 5aba150
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ jobs:

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup dotnet ${{ matrix.dotnetVersion }}
uses: actions/setup-dotnet@v4
with:
Expand All @@ -102,3 +105,51 @@ jobs:
Get-Content $file.FullName
Write-Host ::endgroup::
}
check_version_command:
runs-on: ubuntu-latest
strategy:
matrix:
targetFramework: [net6.0, net7.0, net8.0]

include:
- targetFramework: net6.0
dotnetVersion: "6.0.x"

- targetFramework: net7.0
dotnetVersion: "7.0.x"

- targetFramework: net8.0
dotnetVersion: "8.0.x"

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup dotnet ${{ matrix.dotnetVersion }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnetVersion }}

- name: restore
run: dotnet restore -p:TargetFramework=${{ matrix.targetFramework }}

- uses: paulhatch/[email protected]
id: version
name: version
with:
tag_prefix: "v"
version_format: "${major}.${minor}.${patch}-test${increment}"

- name: build
run: dotnet publish ./src/NuGetUtility/NuGetUtility.csproj --configuration Release -o ./release -f ${{ matrix.targetFramework }} --no-restore -p:Version=${{ steps.version.outputs.version }}

- name: check app version
shell: pwsh
run: |
$cmdOutput = dotnet ./release/NuGetUtility.dll --version | Out-String
if(!($cmdOutput -like '${{ steps.version.outputs.version }}')) {
Write-Host Versions do not match: read $cmdOutput, expected ${{ steps.version.outputs.version }}
exit 1;
}
1 change: 1 addition & 0 deletions src/NuGetUtility/NuGetUtility.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<PackageType>DotnetTool</PackageType>
<RepositoryType>git</RepositoryType>
<Version>100.100.100</Version>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<PackageId>nuget-license</PackageId>
<ToolCommandName>nuget-license</ToolCommandName>
<Authors>Tom Chavakis,Simon Ensslen</Authors>
Expand Down

0 comments on commit 5aba150

Please sign in to comment.