@@ -56,30 +56,62 @@ jobs:
5656 - name : run semantic release
5757 id : set_semantic_version
5858 run : |
59+ # qqqq
5960 # Set error to not instantly fail so we can check if error is semantic-release classifying no version bump required as an error
60- set +e
61- OUTPUT=$(npx semantic-release 2>&1) || STATUS=$?
61+ # set +e
62+ # OUTPUT=$(npx semantic-release 2>&1) || STATUS=$?
63+ # echo "status = $STATUS"
64+ # set -e
65+ # echo "$OUTPUT"
66+
67+ echo "running semantic-release"
68+ SEMVER_OUTPUT_RAW=$(npx semantic-release 2>&1)
69+ STATUS=$?
6270 echo "status = $STATUS"
63- set -e
64- echo "$OUTPUT"
71+ echo "$SEMVER_OUTPUT_RAW"
72+
73+ # # Check for no changes and set SEMVER_VERSION accordingly
74+ # if echo "$SEMVER_OUTPUT_RAW" | grep -q 'There are no relevant changes'; then
75+ # DEV_SEMVER_VERSION="$FALLBACK_VERSION"
76+ # echo "No relevant changes found - DEV_SEMVER_VERSION=$DEV_SEMVER_VERSION"
77+ # echo "DEV_SEMVER_VERSION=$DEV_SEMVER_VERSION" >> $GITHUB_ENV
78+ # # Check if version bump expected
79+ # elif echo "$SEMVER_OUTPUT_RAW" | grep -q 'Dry run: would publish version'; then
80+ # # Extract the actual version
81+ # DEV_SEMVER_VERSION=$(echo "$SEMVER_OUTPUT_RAW" | grep -oP 'Dry run: would publish version \K[^\s]+' || echo "extract-failed")
82+ # echo "Version change detected - DEV_SEMVER_VERSION=$DEV_SEMVER_VERSION"
83+ # echo "version change required true"
84+ # echo "DEV_SEMVER_VERSION=$DEV_SEMVER_VERSION" >> $GITHUB_ENV
85+ # # Fallback
86+ # else
87+ # echo " ⚠️ Neither 'no changes' nor 'would publish' found. (using fallback)."
88+ # DEV_SEMVER_VERSION="$FALLBACK_VERSION"
89+ # echo "DEV_SEMVER_VERSION=$DEV_SEMVER_VERSION"
90+ # echo "DEV_SEMVER_VERSION=$DEV_SEMVER_VERSION" >> $GITHUB_ENV
91+ # fi
92+
6593
6694 # 0 not exclusively due to no version bump so check output
6795 if [ "${STATUS:-0}" -ne 0 ]; then
68- if echo "$OUTPUT" | grep -q "No release published"; then
96+ echo "Status code is not 0"
97+ if echo "$SEMVER_OUTPUT_RAW" | grep -q "No release published"; then
98+ echo "no version change detected"
6999 # No new version, but we can find the current version
70- echo "No new version required getting current version from git tags"
71- SEMVER_VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0-version-placeholder") # last git tag
100+ # echo "No new version required getting current version from git tags"
101+ # SEMVER_VERSION=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0-version-placeholder") # last git tag
72102 echo "semantic-release-version=$SEMVER_VERSION"
73103 SEMVER_CHANGED=false
74104 echo "Changes do not warrant a version change. gh_pages and packages won't be updated."
75- echo "semantic-release-version=$SEMVER_VERSION" >> $GITHUB_OUTPUT
105+ # echo "semantic-release-version=$SEMVER_VERSION" >> $GITHUB_OUTPUT
76106 echo "semantic-version-change-required=$SEMVER_CHANGED" >> $GITHUB_OUTPUT
77107 exit 0 # treat as success code didnt fail there just was no version increment required
78108 else
109+ echo "exit using status outcome of semver"
79110 exit $STATUS # real error → fail pipeline
80111 fi
81112 else
82- SEMVER_VERSION=$(echo "$OUTPUT" | grep -oP 'Published release \K[\d.]+')
113+ echo "grep semver version"
114+ SEMVER_VERSION=$(echo "$SEMVER_OUTPUT_RAW" | grep -oP 'Published release \K[\d.]+')
83115 echo "semantic-release-version=$SEMVER_VERSION"
84116 # qqqq VERSION=$(echo "$OUTPUT" | grep "Published release" | awk '{print $NF}') - AI suggestion try if issues
85117 # awk is a text-processing tool that splits each line into fields using whitespace by default.
@@ -204,7 +236,7 @@ jobs:
204236 name : Update the production TELBlazor ShowCase page (on this repo)
205237 needs : [build-telblazor-package-and-publish, generate-semantic-version]
206238 runs-on : ubuntu-latest
207- if : ${{ needs.generate-semantic-version.outputs.semantic-release- version != ' ' }} # Only run if there's a version
239+ if : ${{ needs.generate-semantic-version.outputs.semantic-version-change-required == 'true ' }} # Only run if there's a version
208240 env :
209241 TELBLAZOR_PACKAGE_VERSION : ${{ needs.generate-semantic-version.outputs.semantic-release-version }}
210242 steps :
0 commit comments