@@ -34,25 +34,19 @@ jobs:
3434 id : versioning
3535 if : ${{ steps.check_merge.outputs.merged == 'true' }}
3636 run : |
37- PR_LABELS=${{ toJSON(github.event.pull_request.labels) }}
38- labels=$(echo "${PR_LABELS}" | jq -r '.[].name' 2>/dev/null || true)
39-
37+ labels=$(echo '${{ toJSON(github.event.pull_request.labels) }}' | jq -r '.[].name')
4038 echo "PR labels: $labels"
41-
4239 increment="patch"
4340 if echo "$labels" | grep -q "feature"; then
4441 increment="minor"
45- elif echo "$labels" | grep -q "bugfix"; then
46- increment="patch"
4742 fi
48-
49- echo "increment=$increment" >> "$GITHUB_OUTPUT"
43+ echo "increment=$increment" >> $GITHUB_OUTPUT
5044
5145 - name : Get current version
5246 id : get_version
5347 if : ${{ steps.check_merge.outputs.merged == 'true' }}
5448 run : |
55- branchName=" ${{ github.ref_name }}"
49+ branchName=' ${{ github.ref_name }}' # e.g., v1/main
5650 echo "Branch name: $branchName"
5751 if [[ $branchName =~ ^v([0-9]+)/main$ ]]; then
5852 majorVersion="${BASH_REMATCH[1]}"
@@ -76,13 +70,12 @@ jobs:
7670 id : bump_version
7771 if : ${{ steps.check_merge.outputs.merged == 'true' }}
7872 run : |
79- increment=" ${{ steps.versioning.outputs.increment }}"
80- currentVersion=" ${{ steps.get_version.outputs.currentVersion }}"
73+ increment=' ${{ steps.versioning.outputs.increment }}'
74+ currentVersion=' ${{ steps.get_version.outputs.currentVersion }}'
8175 IFS='.' read -ra versionParts <<< "$currentVersion"
8276 major=${versionParts[0]}
8377 minor=${versionParts[1]}
8478 patch=${versionParts[2]}
85-
8679 if [ "$increment" == 'minor' ]; then
8780 minor=$((minor + 1))
8881 patch=0
9285 echo "Unknown increment type: $increment"
9386 exit 1
9487 fi
95-
9688 newVersion="$major.$minor.$patch"
9789 echo "New version: $newVersion"
9890 echo "newVersion=$newVersion" >> $GITHUB_OUTPUT
10496 - name : Update project versions
10597 if : ${{ steps.check_merge.outputs.merged == 'true' }}
10698 run : |
107- newVersion=" ${{ steps.bump_version.outputs.newVersion }}"
108- find . -name '*.csproj' -not -path '*/Cortex.Tests/*' | while read -r csproj; do
99+ newVersion=' ${{ steps.bump_version.outputs.newVersion }}'
100+ find . -name '*.csproj' -not -path '*/Cortex.Tests/*' | while read csproj; do
109101 echo "Updating version in $csproj"
110102 xmlstarlet ed -P -L -u "//Project/PropertyGroup/Version" -v "$newVersion" "$csproj" || \
111103 xmlstarlet ed -P -L -s "//Project/PropertyGroup" -t elem -n "Version" -v "$newVersion" "$csproj"
@@ -117,13 +109,15 @@ jobs:
117109
118110 - name : Pack projects
119111 if : ${{ steps.check_merge.outputs.merged == 'true' }}
120- run : dotnet pack --configuration Release --no-build --output ./artifacts
112+ run : |
113+ dotnet pack --configuration Release --no-build --output ./artifacts
121114
122115 - name : Publish to NuGet
123116 if : ${{ steps.check_merge.outputs.merged == 'true' }}
124117 env :
125118 NUGET_API_KEY : ${{ secrets.NUGET_API_KEY }}
126- run : dotnet nuget push ./artifacts/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json
119+ run : |
120+ dotnet nuget push ./artifacts/*.nupkg --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json
127121
128122 - name : Configure Git
129123 if : ${{ steps.check_merge.outputs.merged == 'true' }}
@@ -134,7 +128,7 @@ jobs:
134128 - name : Create Git tag
135129 if : ${{ steps.check_merge.outputs.merged == 'true' }}
136130 run : |
137- newVersion=" ${{ steps.bump_version.outputs.newVersion }}"
131+ newVersion=' ${{ steps.bump_version.outputs.newVersion }}'
138132 git tag -a "v$newVersion" -m "Release v$newVersion"
139133 git push origin "v$newVersion"
140134
0 commit comments