Skip to content

Commit 64e88e2

Browse files
committed
fix no previous release
1 parent 2444804 commit 64e88e2

File tree

1 file changed

+38
-13
lines changed

1 file changed

+38
-13
lines changed

.github/workflows/release.yml

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,15 @@ jobs:
3737
id: changes
3838
run: |
3939
# Get the last release tag
40-
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
41-
echo "Last tag: $LAST_TAG"
40+
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
41+
echo "Last tag: ${LAST_TAG:-'(none)'}"
4242
4343
# Check if there are changes in source code since last release
44-
if git diff --quiet $LAST_TAG HEAD -- '*.go' 'go.mod' 'go.sum' 'Dockerfile' '.github/workflows/' 'internal/' 'cmd/'; then
44+
if [[ -z "$LAST_TAG" ]]; then
45+
# No previous tags, this is the first release
46+
echo "No previous tags found - first release"
47+
echo "should_release=true" >> $GITHUB_OUTPUT
48+
elif git diff --quiet $LAST_TAG HEAD -- '*.go' 'go.mod' 'go.sum' 'Dockerfile' '.github/workflows/' 'internal/' 'cmd/'; then
4549
echo "No significant changes detected"
4650
echo "should_release=false" >> $GITHUB_OUTPUT
4751
else
@@ -54,23 +58,39 @@ jobs:
5458
if: steps.changes.outputs.should_release == 'true' || github.event_name == 'workflow_dispatch'
5559
run: |
5660
# Get the last release tag
57-
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
58-
echo "Last tag: $LAST_TAG"
59-
60-
# Remove 'v' prefix and split version
61-
VERSION_NUMBER=${LAST_TAG#v}
62-
IFS='.' read -r -a VERSION_PARTS <<< "$VERSION_NUMBER"
61+
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
62+
echo "Last tag: ${LAST_TAG:-'(none)'}"
6363
64-
MAJOR=${VERSION_PARTS[0]:-0}
65-
MINOR=${VERSION_PARTS[1]:-0}
66-
PATCH=${VERSION_PARTS[2]:-0}
64+
# Handle first release vs. subsequent releases
65+
if [[ -z "$LAST_TAG" ]]; then
66+
# First release - start from v0.0.0
67+
MAJOR=0
68+
MINOR=0
69+
PATCH=0
70+
echo "First release - starting from v0.0.0"
71+
else
72+
# Remove 'v' prefix and split version
73+
VERSION_NUMBER=${LAST_TAG#v}
74+
IFS='.' read -r -a VERSION_PARTS <<< "$VERSION_NUMBER"
75+
76+
MAJOR=${VERSION_PARTS[0]:-0}
77+
MINOR=${VERSION_PARTS[1]:-0}
78+
PATCH=${VERSION_PARTS[2]:-0}
79+
fi
6780
6881
# Determine release type
6982
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
7083
RELEASE_TYPE="${{ github.event.inputs.release_type }}"
7184
else
7285
# Auto-determine based on commit messages since last release
73-
COMMITS=$(git log $LAST_TAG..HEAD --oneline)
86+
if [[ -z "$LAST_TAG" ]]; then
87+
# First release - check all commits
88+
COMMITS=$(git log --oneline)
89+
else
90+
# Subsequent release - check commits since last tag
91+
COMMITS=$(git log $LAST_TAG..HEAD --oneline)
92+
fi
93+
7494
if echo "$COMMITS" | grep -qE "(BREAKING CHANGE|!:)"; then
7595
RELEASE_TYPE="major"
7696
elif echo "$COMMITS" | grep -qE "(feat:|feature:)"; then
@@ -135,7 +155,12 @@ jobs:
135155
echo "- 🎬 Movie library processing with TMDb integration" >> changelog.md
136156
echo "- 📺 TV show library processing with TMDb integration" >> changelog.md
137157
echo "- 🏷️ Smart label/genre management" >> changelog.md
158+
echo "- 🔒 Field locking and unlocking capabilities" >> changelog.md
138159
echo "- 🐳 Docker container with multi-architecture support" >> changelog.md
160+
echo "" >> changelog.md
161+
echo "### Breaking Changes" >> changelog.md
162+
echo "- Environment variable changes: \`LIBRARY_ID\` → \`MOVIE_LIBRARY_ID\`" >> changelog.md
163+
echo "- No default library processing - requires explicit configuration" >> changelog.md
139164
fi
140165
141166
echo "" >> changelog.md

0 commit comments

Comments
 (0)