Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 48 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [main]

jobs:
build:
test:
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down Expand Up @@ -98,3 +98,50 @@ jobs:
git commit -m "Update coverage badges"
git push origin coverage
fi

verify-frameworks:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: ['8.0', '9.0', '10.0']

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

- name: Setup .NET SDKs
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x

- name: Build Example Apps
run: |
dotnet build tests/SimpleBranchVersioning.ExampleApp -c Release
dotnet build tests/SimpleBranchVersioning.ConfiguredApp -c Release

- name: Run ExampleApp
run: dotnet run --project tests/SimpleBranchVersioning.ExampleApp -f net${{ matrix.dotnet-version }} -c Release --no-build

- name: Run ConfiguredApp
run: dotnet run --project tests/SimpleBranchVersioning.ConfiguredApp -f net${{ matrix.dotnet-version }} -c Release --no-build

- name: Verify version.json
run: |
# ConfiguredApp should have version.json (GenerateVersionFile=true)
if [ ! -f "tests/SimpleBranchVersioning.ConfiguredApp/bin/Release/net${{ matrix.dotnet-version }}/version.json" ]; then
echo "::error::ConfiguredApp is missing version.json for net${{ matrix.dotnet-version }}"
exit 1
fi
echo "ConfiguredApp version.json exists for net${{ matrix.dotnet-version }}"
cat tests/SimpleBranchVersioning.ConfiguredApp/bin/Release/net${{ matrix.dotnet-version }}/version.json

# ExampleApp should NOT have version.json (GenerateVersionFile=false by default)
if [ -f "tests/SimpleBranchVersioning.ExampleApp/bin/Release/net${{ matrix.dotnet-version }}/version.json" ]; then
echo "::error::ExampleApp should not have version.json for net${{ matrix.dotnet-version }}"
exit 1
fi
echo "ExampleApp correctly has no version.json for net${{ matrix.dotnet-version }}"
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,55 @@ on:
- 'release/v*'

jobs:
verify-frameworks:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: ['8.0', '9.0', '10.0']

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

- name: Setup .NET SDKs
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x

- name: Build Example Apps
run: |
dotnet build tests/SimpleBranchVersioning.ExampleApp -c Release
dotnet build tests/SimpleBranchVersioning.ConfiguredApp -c Release

- name: Run ExampleApp
run: dotnet run --project tests/SimpleBranchVersioning.ExampleApp -f net${{ matrix.dotnet-version }} -c Release --no-build

- name: Run ConfiguredApp
run: dotnet run --project tests/SimpleBranchVersioning.ConfiguredApp -f net${{ matrix.dotnet-version }} -c Release --no-build

- name: Verify version.json
run: |
# ConfiguredApp should have version.json (GenerateVersionFile=true)
if [ ! -f "tests/SimpleBranchVersioning.ConfiguredApp/bin/Release/net${{ matrix.dotnet-version }}/version.json" ]; then
echo "::error::ConfiguredApp is missing version.json for net${{ matrix.dotnet-version }}"
exit 1
fi
echo "ConfiguredApp version.json exists for net${{ matrix.dotnet-version }}"
cat tests/SimpleBranchVersioning.ConfiguredApp/bin/Release/net${{ matrix.dotnet-version }}/version.json

# ExampleApp should NOT have version.json (GenerateVersionFile=false by default)
if [ -f "tests/SimpleBranchVersioning.ExampleApp/bin/Release/net${{ matrix.dotnet-version }}/version.json" ]; then
echo "::error::ExampleApp should not have version.json for net${{ matrix.dotnet-version }}"
exit 1
fi
echo "ExampleApp correctly has no version.json for net${{ matrix.dotnet-version }}"

release:
needs: verify-frameworks
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ else
</Task>
</UsingTask>

<Target Name="GenerateVersionFile" AfterTargets="Build" Condition="'$(GenerateVersionFile)' == 'true'">
<Target Name="GenerateVersionFile" AfterTargets="Build" Condition="'$(GenerateVersionFile)' == 'true' and '$(TargetFramework)' != ''">
<PropertyGroup>
<VersionFileOutputPath Condition="'$(VersionFileOutputPath)' == ''">$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '$(OutputPath)', 'version.json'))</VersionFileOutputPath>
</PropertyGroup>
Expand Down Expand Up @@ -75,7 +75,7 @@ else
AfterTargets="GenerateVersionFile"
DependsOnTargets="GenerateVersionFileInternal"
BeforeTargets="GenerateNuspec;Pack"
Condition="'$(SetPackageVersionFromBranch)' == 'true'">
Condition="'$(SetPackageVersionFromBranch)' == 'true' and '$(TargetFramework)' != ''">
<ReadPackageVersionFromJsonTask JsonPath="$(VersionFileOutputPath)">
<Output TaskParameter="PackageVersionOutput" PropertyName="Version" />
<Output TaskParameter="PackageVersionOutput" PropertyName="PackageVersion" />
Expand All @@ -86,7 +86,7 @@ else
<!-- Internal target to generate version.json when SetPackageVersionFromBranch is enabled -->
<Target Name="GenerateVersionFileInternal"
AfterTargets="Build"
Condition="'$(SetPackageVersionFromBranch)' == 'true'">
Condition="'$(SetPackageVersionFromBranch)' == 'true' and '$(TargetFramework)' != ''">
<PropertyGroup>
<VersionFileOutputPath Condition="'$(VersionFileOutputPath)' == ''">$([System.IO.Path]::Combine('$(MSBuildProjectDirectory)', '$(OutputPath)', 'version.json'))</VersionFileOutputPath>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<!-- Example: Generate version.json file -->
<GenerateVersionFile>true</GenerateVersionFile>
<!-- Example: Automatic package version setting (default: true) -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading