@@ -14,116 +14,26 @@ env:
1414 DOTNET_CLI_TELEMETRY_OPTOUT : true
1515
1616jobs :
17- calculate-version :
18- name : " Calculate Version"
19- runs-on : ubuntu-latest
20- outputs :
21- version : ${{ steps.gitversion.outputs.semVer }}
22- nuget-version : ${{ steps.gitversion.outputs.nuGetVersionV2 }}
23- assembly-version : ${{ steps.gitversion.outputs.assemblySemVer }}
24- file-version : ${{ steps.gitversion.outputs.assemblySemFileVer }}
25- informational-version : ${{ steps.gitversion.outputs.informationalVersion }}
26- is-prerelease : ${{ contains(steps.gitversion.outputs.nuGetVersionV2, '-') }}
27-
28- steps :
29- - uses : actions/checkout@v4
30- with :
31- fetch-depth : 0
32-
33- - name : Install GitVersion
34- uses : gittools/actions/gitversion/setup@v1.1.1
35- with :
36- versionSpec : ' 5.x'
37-
38- - name : Determine Version
39- id : gitversion
40- uses : gittools/actions/gitversion/execute@v1.1.1
41-
42- - name : Display GitVersion Results
43- run : |
44- echo "🔍 GitVersion 5.x Results:"
45- echo "Branch: ${{ github.ref }}"
46- echo "SemVer: '${{ steps.gitversion.outputs.semVer }}'"
47- echo "NuGetVersionV2: '${{ steps.gitversion.outputs.nuGetVersionV2 }}'"
48- echo "AssemblySemVer: '${{ steps.gitversion.outputs.assemblySemVer }}'"
49- echo "AssemblySemFileVer: '${{ steps.gitversion.outputs.assemblySemFileVer }}'"
50- echo "InformationalVersion: '${{ steps.gitversion.outputs.informationalVersion }}'"
51- echo "PreReleaseTag: '${{ steps.gitversion.outputs.preReleaseTag }}'"
52- echo "PreReleaseNumber: '${{ steps.gitversion.outputs.preReleaseNumber }}'"
53- echo "CommitsSinceVersionSource: '${{ steps.gitversion.outputs.commitsSinceVersionSource }}'"
54- echo "Is Pre-release: ${{ contains(steps.gitversion.outputs.nuGetVersionV2, '-') }}"
55- echo ""
56- echo "📋 Expected behavior:"
57- echo "- CD workflow should ALWAYS produce pre-release versions"
58- echo "- main branch should produce versions like: X.Y.Z-alpha.N"
59- echo "- develop branch should produce versions like: X.Y.Z-dev.N"
60- echo "- Only tagged releases from release workflow should produce stable versions"
61-
6217 build :
63- needs : calculate-version
6418 name : " Build and Test"
65- strategy :
66- matrix :
67- include :
68- - dotnet : ' 8.0.x'
69- dotnet-framework : ' net8.0'
70- os : ubuntu-latest
71- - dotnet : ' 8.0.x'
72- dotnet-framework : ' net8.0'
73- os : windows-latest
74- - dotnet : ' 9.0.x'
75- dotnet-framework : ' net9.0'
76- os : ubuntu-latest
77- - dotnet : ' 9.0.x'
78- dotnet-framework : ' net9.0'
79- os : windows-latest
80-
81- runs-on : ${{ matrix.os }}
82-
83- steps :
84- - uses : actions/checkout@v4
85- with :
86- fetch-depth : 0
87-
88- - name : Setup .NET ${{ matrix.dotnet }}
89- uses : actions/setup-dotnet@v4
90- with :
91- dotnet-version : ${{ matrix.dotnet }}
92-
93- - name : Display Build Version Info
94- run : |
95- echo "🔍 Build Version Information (from GitVersion 5.x):"
96- echo "SemVer: ${{ needs.calculate-version.outputs.version }}"
97- echo "NuGet Version: ${{ needs.calculate-version.outputs.nuget-version }}"
98- echo "Assembly Version: ${{ needs.calculate-version.outputs.assembly-version }}"
99- echo "File Version: ${{ needs.calculate-version.outputs.file-version }}"
100- echo "Informational Version: ${{ needs.calculate-version.outputs.informational-version }}"
101- echo "Is Pre-release: ${{ needs.calculate-version.outputs.is-prerelease }}"
102-
103- - name : Restore dependencies
104- run : dotnet restore -p:TargetFramework=${{ matrix.dotnet-framework }}
105-
106- - name : Build
107- run : |
108- echo "🏗️ Building with GitVersion 5.x integration..."
109- dotnet build --no-restore -c Release -f ${{ matrix.dotnet-framework }} -p:UseGitVersion=true --verbosity normal
110-
111- - name : Test
112- run : dotnet test --no-build --verbosity normal -c Release -f ${{ matrix.dotnet-framework }}
19+ uses : ./.github/workflows/build-test.yml
20+ with :
21+ configuration : Release
11322
11423 publish :
115- needs : [calculate-version, build]
24+ needs : build
11625 name : " Publish Pre-release Packages (CI/CD)"
11726 if : github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
11827 uses : ./.github/workflows/publish.yml
11928 with :
12029 publish-to-nuget : false
12130 build-configuration : ' Release'
122- version : ${{ needs.calculate-version.outputs.version }}
123- nuget-version : ${{ needs.calculate-version.outputs.nuget-version }}
124- assembly-version : ${{ needs.calculate-version.outputs.assembly-version }}
125- informational-version : ${{ needs.calculate-version.outputs.informational-version }}
126- secrets : inherit
31+ version : ${{ needs.build.outputs.version }}
32+ nuget-version : ${{ needs.build.outputs.nuget-version }}
33+ assembly-version : ${{ needs.build.outputs.assembly-version }}
34+ informational-version : ${{ needs.build.outputs.informational-version }}
35+ secrets :
36+ github-token : ${{ secrets.GITHUB_TOKEN }}
12737
12838 clean :
12939 needs : publish
@@ -132,39 +42,21 @@ jobs:
13242 uses : ./.github/workflows/clean-packages.yml
13343
13444 summary :
135- needs : [calculate-version, build, publish]
45+ needs : [build, publish]
13646 runs-on : ubuntu-latest
13747 if : always()
13848 steps :
13949 - name : CD Workflow Summary
14050 run : |
141- echo "## 🚀 CD Workflow Summary (GitVersion 5.x Direct) " >> $GITHUB_STEP_SUMMARY
51+ echo "## 🚀 CD Workflow Summary" >> $GITHUB_STEP_SUMMARY
14252 echo "" >> $GITHUB_STEP_SUMMARY
14353 echo "| Property | Value |" >> $GITHUB_STEP_SUMMARY
14454 echo "|----------|-------|" >> $GITHUB_STEP_SUMMARY
14555 echo "| Branch | \`${{ github.ref_name }}\` |" >> $GITHUB_STEP_SUMMARY
146- echo "| Version (GitVersion) | \`${{ needs.calculate-version.outputs.version }}\` |" >> $GITHUB_STEP_SUMMARY
147- echo "| NuGet Version (GitVersion) | \`${{ needs.calculate-version.outputs.nuget-version }}\` |" >> $GITHUB_STEP_SUMMARY
148- echo "| Assembly Version (GitVersion) | \`${{ needs.calculate-version.outputs.assembly-version }}\` |" >> $GITHUB_STEP_SUMMARY
149- echo "| Pre-release | ${{ needs.calculate-version.outputs.is-prerelease == 'true' && '✅ Yes' || '❌ No' }} |" >> $GITHUB_STEP_SUMMARY
56+ echo "| Version | \`${{ needs.build.outputs.version }}\` |" >> $GITHUB_STEP_SUMMARY
57+ echo "| NuGet Version | \`${{ needs.build.outputs.nuget-version }}\` |" >> $GITHUB_STEP_SUMMARY
58+ echo "| Assembly Version | \`${{ needs.build.outputs.assembly-version }}\` |" >> $GITHUB_STEP_SUMMARY
59+ echo "| Version Source | \`${{ needs.build.outputs.version-source }}\` |" >> $GITHUB_STEP_SUMMARY
60+ echo "| Pre-release | ${{ contains(needs.build.outputs.nuget-version, '-') && '✅ Yes' || '❌ No' }} |" >> $GITHUB_STEP_SUMMARY
15061 echo "| Published to GitHub | ${{ needs.publish.result == 'success' && '✅ Yes' || '❌ No' }} |" >> $GITHUB_STEP_SUMMARY
151- echo "" >> $GITHUB_STEP_SUMMARY
152-
153- if [ "${{ needs.calculate-version.outputs.is-prerelease }}" == "true" ]; then
154- echo "🎯 **Pre-release Package**: This version is directly from GitVersion 5.x" >> $GITHUB_STEP_SUMMARY
155- echo "📦 **Usage**: Install with \`--prerelease\` flag: \`dotnet add package PackageName --version ${{ needs.calculate-version.outputs.nuget-version }} --prerelease\`" >> $GITHUB_STEP_SUMMARY
156- echo "✅ **GitVersion Direct**: No manual version construction - all versions from GitVersion 5.x" >> $GITHUB_STEP_SUMMARY
157- else
158- echo "⚠️ **Warning**: GitVersion produced a stable version!" >> $GITHUB_STEP_SUMMARY
159- echo "🏷️ **Current**: \`${{ needs.calculate-version.outputs.nuget-version }}\`" >> $GITHUB_STEP_SUMMARY
160- echo "🔧 **Action Required**: Check GitVersion configuration for branch labeling" >> $GITHUB_STEP_SUMMARY
161- fi
162- echo "" >> $GITHUB_STEP_SUMMARY
163- echo "📋 **Versioning Strategy**:" >> $GITHUB_STEP_SUMMARY
164- echo "- **CI/CD Workflow** (this): GitVersion 5.x calculates all versions directly" >> $GITHUB_STEP_SUMMARY
165- echo " - **main**: GitVersion → \`X.Y.Z-alpha.N\` versions" >> $GITHUB_STEP_SUMMARY
166- echo " - **develop**: GitVersion → \`X.Y.Z-dev.N\` versions" >> $GITHUB_STEP_SUMMARY
167- echo "- **Release Workflow**: GitVersion produces stable versions from tags (\`X.Y.Z\`)" >> $GITHUB_STEP_SUMMARY
168- echo "- **Build Process**: Uses \`-p:UseGitVersion=true\` to integrate directly" >> $GITHUB_STEP_SUMMARY
169- echo "" >> $GITHUB_STEP_SUMMARY
170- echo "📦 **Published Packages**: Check the [GitHub Packages](https://github.com/${{ github.repository }}/pkgs) for the published packages." >> $GITHUB_STEP_SUMMARY
62+ shell : bash
0 commit comments