|
16 | 16 | - name: Checkout git repo |
17 | 17 | uses: actions/checkout@v4 |
18 | 18 | with: |
19 | | - fetch-depth: 0 # Fetch all history for proper release notes |
| 19 | + fetch-depth: 0 # Fetch all history for release notes |
20 | 20 |
|
21 | 21 | - name: Install Node and NPM |
22 | 22 | uses: actions/setup-node@v4 |
@@ -51,23 +51,18 @@ jobs: |
51 | 51 | - name: Create Release |
52 | 52 | if: steps.version_check.outputs.versionChanged == 'true' |
53 | 53 | run: | |
54 | | - # Get the previous version tag |
55 | | - PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") |
| 54 | + # Get the previous version tag or initial commit |
| 55 | + PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo $(git rev-list --max-parents=0 HEAD)) |
| 56 | + CURR_TAG="v${{ steps.version_check.outputs.rawVersion }}" |
56 | 57 |
|
57 | | - if [ -z "$PREV_TAG" ]; then |
58 | | - # If no previous tag exists, use the first commit |
59 | | - PREV_COMMIT=$(git rev-list --max-parents=0 HEAD) |
60 | | - COMMIT_RANGE="$PREV_COMMIT..HEAD" |
61 | | - else |
62 | | - COMMIT_RANGE="$PREV_TAG..HEAD" |
63 | | - fi |
| 58 | + # Generate simple release notes with commit messages |
| 59 | + NOTES=$(git log --pretty=format:"* %s" $PREV_TAG..HEAD --no-merges) |
| 60 | + echo "## What's Changed" > release_notes.md |
| 61 | + echo "" >> release_notes.md |
| 62 | + echo "$NOTES" >> release_notes.md |
64 | 63 |
|
65 | | - # Generate release notes with commit messages |
66 | | - RELEASE_NOTES=$(echo -e "## What's Changed\n\n") |
67 | | - RELEASE_NOTES+=$(git log $COMMIT_RANGE --pretty=format:"* %s" --no-merges) |
68 | | -
|
69 | | - # Create release with the generated notes |
70 | | - gh release create "v${{ steps.version_check.outputs.rawVersion }}" --notes "$RELEASE_NOTES" |
| 64 | + # Create the release with notes |
| 65 | + gh release create "$CURR_TAG" --notes-file release_notes.md |
71 | 66 | env: |
72 | 67 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
73 | 68 |
|
|
0 commit comments