File tree Expand file tree Collapse file tree 1 file changed +36
-9
lines changed Expand file tree Collapse file tree 1 file changed +36
-9
lines changed Original file line number Diff line number Diff line change @@ -67,16 +67,43 @@ jobs:
6767        env :
6868          GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} 
6969        run : | 
70+           # Try to generate notes using GitHub's API first 
71+           GENERATED_NOTES=$(gh api repos/$GITHUB_REPOSITORY/releases/generate-notes -f tag_name=v${{ steps.version.outputs.VERSION }} --jq .body 2>/dev/null || echo "") 
72+            
73+           # If GitHub's generation worked and has content beyond just "Full Changelog" 
74+           if [[ "$GENERATED_NOTES" != *"**Full Changelog**"* ]] && [[ -n "$GENERATED_NOTES" ]]; then 
75+             RELEASE_BODY="## Docker Image 
76+ 
77+           \`\`\`bash 
78+           docker pull ${{ env.DOCKER_REPO }}/${{ env.DOCKER_IMAGE }}:${{ steps.version.outputs.VERSION }} 
79+           \`\`\` 
80+ 
81+           $GENERATED_NOTES" 
82+           else 
83+             # Fallback to commit-based notes 
84+             PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") 
85+             if [[ -n "$PREV_TAG" ]]; then 
86+               COMMIT_NOTES=$(git log ${PREV_TAG}..HEAD --pretty=format:"* %s (%h)" | head -20) 
87+               CHANGELOG_LINK="**Full Changelog**: https://github.com/$GITHUB_REPOSITORY/compare/${PREV_TAG}...v${{ steps.version.outputs.VERSION }}" 
88+             else 
89+               COMMIT_NOTES=$(git log --pretty=format:"* %s (%h)" | head -20) 
90+               CHANGELOG_LINK="" 
91+             fi 
92+              
93+             RELEASE_BODY="## Docker Image 
94+ 
95+           \`\`\`bash 
96+           docker pull ${{ env.DOCKER_REPO }}/${{ env.DOCKER_IMAGE }}:${{ steps.version.outputs.VERSION }} 
97+           \`\`\` 
98+ 
99+           ## What's Changed 
100+           $COMMIT_NOTES 
101+ 
102+           $CHANGELOG_LINK" 
103+           fi 
104+            
70105          gh release create "v${{ steps.version.outputs.VERSION }}" \ 
71106            --repo="$GITHUB_REPOSITORY" \ 
72107            --title="Release ${{ steps.version.outputs.VERSION }}" \ 
73-             --notes-file <(cat <<'EOF' 
74-           ## Docker Image 
75- 
76-           ```bash 
77-           docker pull ${{ env.DOCKER_REPO }}/${{ env.DOCKER_IMAGE }}:${{ steps.version.outputs.VERSION }} 
78-           ``` 
79-           EOF 
80-           ) \ 
81-             --generate-notes \ 
108+             --notes "$RELEASE_BODY" \ 
82109            --draft 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments