diff --git a/.github/workflows/deploy-package.yml b/.github/workflows/deploy-package.yml index c2a1c901b..fff7bd86f 100644 --- a/.github/workflows/deploy-package.yml +++ b/.github/workflows/deploy-package.yml @@ -46,14 +46,14 @@ jobs: - name: Set default inputs for dispatch id: settings run: | - if [[ "${{ github.event_name }}" == "worfklow_dispatch" ]]; then + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then echo "environ=${{ inputs.environment }}" >> $GITHUB_OUTPUT echo "preview=${{ inputs.preview }}" >> $GITHUB_OUTPUT echo "dry_run=${{ inputs.dry_run }}" >> $GITHUB_OUTPUT else - echo "environ='NO ENVIRONMENT" >> $GITHUB_OUTPUT - echo "preview=true" >> $GITHUB_OUTPUT - echo "dry_run=true" >> $GITHUB_OUTPUT + echo "environ=NO_ENVIRONMENT" >> $GITHUB_OUTPUT + echo "preview=true" >> $GITHUB_OUTPUT + echo "dry_run=true" >> $GITHUB_OUTPUT fi - name: Checkout source @@ -67,12 +67,6 @@ jobs: dotnet-version: "9.x" dotnet-quality: "ga" - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: "9.x" - dotnet-quality: "ga" - - name: Setup GitVersion uses: gittools/actions/gitversion/setup@v1.2.0 with: @@ -93,16 +87,19 @@ jobs: - name: Compose version id: version_info run: | - # get base version + # get base version from GitVersion (respects tags on main, next-version on others) base="${{ steps.gitversion.outputs.majorMinorPatch }}" - # determine preview suffix - preview_tag="${{ steps.settings.outputs.preview && '-preview.' || '' }}" - - # determine preview number - preview_num="${{ steps.settings.outputs.preview && steps.gitversion.outputs.preReleaseNumber || '' }}" + # preview suffix controlled by workflow input + gitversion config + if [[ "${{ steps.settings.outputs.preview }}" == "true" ]]; then + # respect GitVersion preview tag config from gitversion.yml + preview_tag="-${{ steps.gitversion.outputs.preReleaseTag }}." + preview_num="${{ steps.gitversion.outputs.preReleaseNumber }}" + else + preview_tag="" + preview_num="" + fi - # combine all parts ver="${base}${preview_tag}${preview_num}" echo "version=$ver" >> "$GITHUB_OUTPUT" diff --git a/src/gitversion.yml b/src/gitversion.yml index bb29a6ab1..aca09bb8c 100644 --- a/src/gitversion.yml +++ b/src/gitversion.yml @@ -1,5 +1,5 @@ mode: ContinuousDelivery -next-version: 3.0.0 +next-version: 3.0.0 # only affects non-main branches commit-message-incrementing: Enabled major-version-bump-message: '\+semver:\s?(breaking|major)' @@ -8,7 +8,22 @@ patch-version-bump-message: '\+semver:\s?(fix|patch)' no-bump-message: '\+semver:\s?(none|skip)' branches: + main: + regex: ^main$ + increment: Patch + is-release-branch: true + is-mainline: true + pre-release-weight: 0 + prevent-increment-of-merged-branch-version: true + tag: '' pull-request: tag: preview + increment: PreReleaseNumber + prevent-increment-of-merged-branch-version: false + source-branches: ['main'] feature: + regex: ^v\d+\..* tag: preview + increment: PreReleaseNumber + prevent-increment-of-merged-branch-version: false + source-branches: ['main']