Skip to content

Commit af0f230

Browse files
committed
Adjustments to the versioning configurations
1 parent d29bf66 commit af0f230

3 files changed

Lines changed: 28 additions & 6 deletions

File tree

.github/workflows/cd.yml

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ jobs:
5858
echo "⚠️ SemVer is empty or invalid, using fallback"
5959
if [ "${{ github.ref }}" = "refs/heads/develop" ]; then
6060
VERSION="1.0.0-dev.1"
61+
elif [ "${{ github.ref }}" = "refs/heads/main" ]; then
62+
VERSION="1.0.0-main.1"
6163
else
6264
VERSION="1.0.0-dev"
6365
fi
@@ -91,11 +93,14 @@ jobs:
9193
INFORMATIONAL_VERSION="$VERSION"
9294
fi
9395
94-
# Determine if this is a pre-release
96+
# Determine if this is a pre-release (should always be true for CD workflow)
9597
IS_PRERELEASE="false"
9698
if [[ "$NUGET_VERSION" == *"-"* ]]; then
9799
IS_PRERELEASE="true"
98100
echo "🎯 Pre-release version detected: $NUGET_VERSION"
101+
else
102+
echo "⚠️ Warning: CD workflow should always produce pre-release versions!"
103+
echo "⚠️ Current version: $NUGET_VERSION appears to be stable"
99104
fi
100105
101106
echo "✅ Validated versions:"
@@ -123,6 +128,10 @@ jobs:
123128
echo "File Version: ${{ steps.validate-version.outputs.FILE_VERSION }}"
124129
echo "Informational Version: ${{ steps.validate-version.outputs.INFORMATIONAL_VERSION }}"
125130
echo "Is Pre-release: ${{ steps.validate-version.outputs.IS_PRERELEASE }}"
131+
echo ""
132+
echo "📋 Expected behavior:"
133+
echo "- CD workflow should ALWAYS produce pre-release versions"
134+
echo "- Only tagged releases from release workflow should produce stable versions"
126135
127136
build:
128137
needs: calculate-version
@@ -177,15 +186,17 @@ jobs:
177186
-p:AssemblyVersion="${{ needs.calculate-version.outputs.assembly-version }}" \
178187
-p:FileVersion="${{ needs.calculate-version.outputs.file-version }}" \
179188
-p:InformationalVersion="${{ needs.calculate-version.outputs.informational-version }}" \
180-
-p:UseGitVersion=false
189+
-p:UseGitVersion=false \
190+
--verbosity normal
181191
shell: bash
182192

183193
- name: Test
184194
run: dotnet test --no-build --verbosity normal -c Release -f ${{ matrix.dotnet-framework }}
185195

196+
186197
publish:
187198
needs: [calculate-version, build]
188-
name: "Publish Pre-release Packages"
199+
name: "Publish Pre-release Packages (CI/CD)"
189200
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
190201
uses: ./.github/workflows/publish.yml
191202
with:
@@ -210,7 +221,7 @@ jobs:
210221
steps:
211222
- name: CD Workflow Summary
212223
run: |
213-
echo "## 🚀 CD Workflow Summary" >> $GITHUB_STEP_SUMMARY
224+
echo "## 🚀 CD Workflow Summary (Pre-release Only)" >> $GITHUB_STEP_SUMMARY
214225
echo "" >> $GITHUB_STEP_SUMMARY
215226
echo "| Property | Value |" >> $GITHUB_STEP_SUMMARY
216227
echo "|----------|-------|" >> $GITHUB_STEP_SUMMARY
@@ -225,8 +236,15 @@ jobs:
225236
if [ "${{ needs.calculate-version.outputs.is-prerelease }}" == "true" ]; then
226237
echo "🎯 **Pre-release Package**: This version includes commit count and pre-release identifier" >> $GITHUB_STEP_SUMMARY
227238
echo "📦 **Usage**: Install with \`--prerelease\` flag: \`dotnet add package PackageName --version ${{ needs.calculate-version.outputs.nuget-version }} --prerelease\`" >> $GITHUB_STEP_SUMMARY
239+
echo "✅ **Expected Behavior**: CD workflow correctly produces pre-release versions" >> $GITHUB_STEP_SUMMARY
228240
else
229-
echo "🏷️ **Stable Package**: This is a stable release version" >> $GITHUB_STEP_SUMMARY
241+
echo "⚠️ **Warning**: CD workflow should always produce pre-release versions!" >> $GITHUB_STEP_SUMMARY
242+
echo "🏷️ **Current**: This appears to be a stable version: \`${{ needs.calculate-version.outputs.nuget-version }}\`" >> $GITHUB_STEP_SUMMARY
243+
echo "🔧 **Action Required**: Check GitVersion configuration" >> $GITHUB_STEP_SUMMARY
230244
fi
231245
echo "" >> $GITHUB_STEP_SUMMARY
246+
echo "📋 **Versioning Strategy**:" >> $GITHUB_STEP_SUMMARY
247+
echo "- **CI/CD Workflow** (this): Always produces pre-release versions" >> $GITHUB_STEP_SUMMARY
248+
echo "- **Release Workflow**: Only produces stable versions from tags" >> $GITHUB_STEP_SUMMARY
249+
echo "" >> $GITHUB_STEP_SUMMARY
232250
echo "📦 **Published Packages**: Check the [GitHub Packages](https://github.com/${{ github.repository }}/pkgs) for the published packages." >> $GITHUB_STEP_SUMMARY

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,4 @@ jobs:
168168
echo "🎉 Packages have been published to both GitHub Packages and NuGet.org!" >> $GITHUB_STEP_SUMMARY
169169
else
170170
echo "📦 Packages have been published to GitHub Packages only." >> $GITHUB_STEP_SUMMARY
171-
fi fi
171+
fi

GitVersion.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ workflow: GitHubFlow/v1
22
mode: ContinuousDeployment
33
tag-prefix: '[vV]?'
44
branches:
5+
main:
6+
regex: ^master$|^main$
7+
label: 'alpha'
8+
increment: Patch
59
develop:
610
regex: ^dev(elop)?(ment)?$
711
label: 'dev'

0 commit comments

Comments
 (0)