Skip to content

Commit a31a283

Browse files
committed
fix(release): skip release without version bump
1 parent 04c1066 commit a31a283

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

.github/workflows/main.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,12 @@ jobs:
164164
FILE="src/cloudsync.h"
165165
VERSION=$(grep -oP '#define CLOUDSYNC_VERSION\s+"\K[^"]+' "$FILE")
166166
if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
167-
echo "version=$VERSION" >> $GITHUB_OUTPUT
167+
LATEST=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.name')
168+
if [[ "$VERSION" != "$LATEST" ]]; then
169+
echo "version=$VERSION" >> $GITHUB_OUTPUT
170+
else
171+
echo "::warning file=src/cloudsync.h::To release a new version, please update the CLOUDSYNC_VERSION in src/cloudsync.h to be different than the latest $LATEST"
172+
fi
168173
exit 0
169174
fi
170175
echo "❌ CLOUDSYNC_VERSION not found in cloudsync.h"
@@ -184,6 +189,7 @@ jobs:
184189
done
185190
186191
- uses: softprops/[email protected]
192+
if: steps.tag.outputs.version != ''
187193
with:
188194
generate_release_notes: true
189195
tag_name: ${{ steps.tag.outputs.version }}

0 commit comments

Comments
 (0)