Skip to content

Commit c024ec2

Browse files
Update release.yml
1 parent caff2a3 commit c024ec2

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

.github/workflows/release.yml

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,25 @@ jobs:
2828
echo "VERSION=$VERSION" >> $GITHUB_ENV
2929
shell: bash
3030

31-
- name: Debug - Print setup.py
32-
run: cat setup.py
33-
34-
- name: Get previous version
35-
id: previous_version
31+
- name: Get previous setup.py commit
32+
id: previous_commit
3633
run: |
37-
echo "Finding previous version..."
38-
if git log -p -1 -- setup.py; then
39-
PREV_VERSION=$(git log -p -1 -- setup.py | grep -oP '(?<=version=\").+?(?=\")')
40-
fi
41-
if [ -z "$PREV_VERSION" ]; then
42-
echo "No previous version found, using initial commit"
43-
PREV_VERSION=$(git rev-list --max-parents=0 HEAD)
44-
fi
45-
echo "PREV_VERSION=${PREV_VERSION}" >> $GITHUB_ENV
46-
echo "Previous version: ${PREV_VERSION}"
47-
shell: bash
34+
echo "Finding previous setup.py commit..."
35+
PREV_COMMIT=$(git log -2 --pretty=format:"%H" -- setup.py | tail -n 1)
36+
echo "PREV_COMMIT=${PREV_COMMIT}" >> $GITHUB_ENV
37+
echo "Previous setup.py commit: ${PREV_COMMIT}"
4838
4939
- name: Generate changelog
5040
id: changelog
5141
run: |
52-
PREV_VERSION=${{ env.PREVIOUS_VERSION }}
42+
PREV_COMMIT=${{ env.PREV_COMMIT }}
5343
CURRENT_VERSION=${{ env.VERSION }}
54-
echo "Generating changelog from $PREV_VERSION to $CURRENT_VERSION"
55-
git log $PREV_VERSION..HEAD --pretty=format:"- %s" > changelog.txt
44+
echo "Generating changelog from $PREV_COMMIT to HEAD"
45+
if [ -n "$PREV_COMMIT" ]; then
46+
git log $PREV_COMMIT..HEAD --pretty=format:"- %s" > changelog.txt
47+
else
48+
git log HEAD --pretty=format:"- %s" > changelog.txt
49+
fi
5650
cat changelog.txt
5751
5852
- name: Install dependencies

0 commit comments

Comments
 (0)