diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..92948868 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,23 @@ +name-template: 'v$RESOLVED_VERSION' +tag-template: 'v$RESOLVED_VERSION' +categories: + - title: '🚀 Features' + labels: + - 'feature' + - 'enhancement' + - title: '🐛 Bug Fixes' + labels: + - 'fix' + - 'bugfix' + - 'bug' + - title: '🧰 Maintenance' + label: 'chore' +change-template: '- $TITLE @$AUTHOR (#$NUMBER)' +template: | + ## Changes + + $CHANGES + + ## Contributors + + $CONTRIBUTORS \ No newline at end of file diff --git a/.github/workflows/pre-release.yaml b/.github/workflows/pre-release.yaml index 1b91535a..073f30ea 100644 --- a/.github/workflows/pre-release.yaml +++ b/.github/workflows/pre-release.yaml @@ -25,20 +25,60 @@ jobs: echo "version=$version" >> $GITHUB_ENV shell: bash + - name: Get Latest Release + id: get_latest_release + uses: octokit/request-action@v2.x + with: + route: GET /repos/{owner}/{repo}/releases/latest + owner: ${{ github.repository_owner }} + repo: ${{ github.event.repository.name }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + continue-on-error: true + + - name: Generate Release Notes + id: generate_notes + uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + config-name: release-drafter.yml + version: ${{ env.version }} + + - name: Prepare Release Body + id: prepare_body + run: | + latest_release_body="${{ fromJson(steps.get_latest_release.outputs.data).body }}" + new_changes="${{ steps.generate_notes.outputs.body }}" + if [[ -z "$latest_release_body" ]]; then + echo "body<> $GITHUB_OUTPUT + echo "$new_changes" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + else + echo "body<> $GITHUB_OUTPUT + echo "$new_changes" >> $GITHUB_OUTPUT + echo "" >> $GITHUB_OUTPUT + echo "Previous Release Notes:" >> $GITHUB_OUTPUT + echo "$latest_release_body" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + fi + - name: Create and Upload Release id: create_release uses: softprops/action-gh-release@v2 with: tag_name: ${{ env.version }} name: Pre-Release ${{ env.version }} - body: "![GitHub Downloads (specific asset, specific tag)](https://img.shields.io/github/downloads/ChrisTitusTech/linutil/${{ env.version }}/linutil)" + body: | + ${{ steps.prepare_body.outputs.body }} + + ![GitHub Downloads (specific asset, specific tag)](https://img.shields.io/github/downloads/ChrisTitusTech/linutil/${{ env.version }}/linutil) append_body: false files: | ./build/linutil ./start.sh ./startdev.sh prerelease: true - generate_release_notes: true env: version: ${{ env.version }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}