2323 with :
2424 fetch-depth : 0
2525 - name : Build Reason
26- run : " echo ref: ${{github.ref}} event: ${{github.event_name}}"
26+ run : |
27+ branch=${GITHUB_REF##*/}.
28+ if [[ "$branch" = "main." ]]; then
29+ branch=""
30+ elif [[ "$branch" = "master." ]]; then
31+ branch=""
32+ elif [[ "${GITHUB_REF}" = refs/tags* ]]; then
33+ branch=""
34+ elif [[ "${GITHUB_REF}" = refs/pull* ]]; then
35+ branch=""
36+ fi
37+ echo "GIT_BRANCH_SUFFIX=$branch" >> $GITHUB_ENV
38+ echo "ref: $GITHUB_REF event: $GITHUB_EVENT_NAME branch_suffix: $branch"
2739 - name : Setup Node.js environment
2840 uses : actions/setup-node@v6
2941 with :
@@ -37,18 +49,28 @@ jobs:
3749 - name : Setup .NET SDK for MinVer
3850 uses : actions/setup-dotnet@v5
3951 with :
40- dotnet-version : " 8.0.x"
41- - name : Set Min Version
42- uses : Stelzi79/action-minver@3.0.1
43- id : version
44- with :
45- minimum-major-minor : 3.0
46- tag-prefix : v
52+ dotnet-version : " 10.0.x"
4753 - name : Build Version
54+ id : version
4855 run : |
56+ dotnet tool install --global minver-cli --version 7.0.0
57+ version=$(minver --tag-prefix v --default-pre-release-identifiers "preview.${GIT_BRANCH_SUFFIX}0" --minimum-major-minor 3.0)
58+
59+ # If on a non-main branch, insert branch name before the height (last numeric segment)
60+ if [ -n "$GIT_BRANCH_SUFFIX" ]; then
61+ branch_name="${GIT_BRANCH_SUFFIX%.}"
62+ if [[ "$version" != *"$branch_name"* ]]; then
63+ version=$(echo "$version" | sed -E "s/\.([0-9]+)$/.${GIT_BRANCH_SUFFIX}\1/")
64+ fi
65+ fi
66+
67+ echo "version=$version" >> $GITHUB_OUTPUT
68+ echo "Version: $version"
69+ echo "### Version: $version" >> $GITHUB_STEP_SUMMARY
70+
4971 npm install --global replace-in-files-cli
50- replace-in-files --string="3.0.0-dev" --replacement=${{steps. version.outputs.version}} packages/core/src/configuration/Configuration.ts
51- replace-in-files --string="3.0.0-dev" --replacement=${{steps. version.outputs.version}} **/package*.json
72+ replace-in-files --string="3.0.0-dev" --replacement=$version packages/core/src/configuration/Configuration.ts
73+ replace-in-files --string="3.0.0-dev" --replacement=$version **/package*.json
5274 npm ci
5375 - name : Build
5476 run : npm run build
@@ -62,14 +84,18 @@ jobs:
6284 env :
6385 NODE_AUTH_TOKEN : ${{secrets.NPM_TOKEN}}
6486 - name : Setup GitHub CI Node.js environment
65- if : github.event_name != 'pull_request' && matrix.os == 'ubuntu-latest'
87+ if : github.event_name != 'pull_request' && startsWith(github.ref, 'refs/heads/') && matrix.os == 'ubuntu-latest' && contains(steps.version.outputs.version, '-')
6688 uses : actions/setup-node@v6
6789 with :
6890 node-version : ${{ matrix.node_version }}
6991 registry-url : " https://npm.pkg.github.com"
7092 scope : " @exceptionless"
7193 - name : Push GitHub CI Packages
72- if : github.event_name != 'pull_request' && matrix.os == 'ubuntu-latest'
73- run : npm publish --workspaces --access public
94+ if : github.event_name != 'pull_request' && startsWith(github.ref, 'refs/heads/') && matrix.os == 'ubuntu-latest' && contains(steps.version.outputs.version, '-')
95+ run : |
96+ TAG_BRANCH="${GIT_BRANCH_SUFFIX%.}"
97+ TAG_BRANCH="${TAG_BRANCH:-main}"
98+ TAG_BRANCH="${TAG_BRANCH//\//-}"
99+ npm publish --workspaces --access public --tag "ci-${TAG_BRANCH}" || true
74100 env :
75101 NODE_AUTH_TOKEN : ${{secrets.GITHUB_TOKEN}}
0 commit comments