diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..3a626c3 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: monthly diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 06b4b44..24fed1b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,6 @@ name: CI -on: - push: - paths: ['**.el'] - pull_request: - paths: ['**.el'] +on: [push, pull_request] jobs: compile: @@ -17,7 +13,7 @@ jobs: steps: - name: Set up Emacs - uses: purcell/setup-emacs@master + uses: purcell/setup-emacs@v8.0 with: version: ${{matrix.emacs_version}} @@ -25,7 +21,7 @@ jobs: run: curl -fsSL https://raw.github.com/doublep/eldev/master/webinstall/github-eldev | sh - name: Check out the source code - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Compile the project run: make compile @@ -40,7 +36,7 @@ jobs: steps: - name: Set up Emacs - uses: purcell/setup-emacs@master + uses: purcell/setup-emacs@v8.0 with: version: ${{matrix.emacs_version}} @@ -48,7 +44,7 @@ jobs: run: curl -fsSL https://raw.github.com/doublep/eldev/master/webinstall/github-eldev | sh - name: Check out the source code - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Lint the project run: make lint @@ -66,7 +62,7 @@ jobs: steps: - name: Set up Emacs - uses: purcell/setup-emacs@master + uses: purcell/setup-emacs@v8.0 with: version: ${{matrix.emacs_version}} @@ -74,7 +70,7 @@ jobs: run: curl -fsSL https://raw.github.com/doublep/eldev/master/webinstall/github-eldev | sh - name: Check out the source code - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Run tests run: make test diff --git a/.github/workflows/github_release.yml b/.github/workflows/github_release.yml index 390eacc..ba76957 100644 --- a/.github/workflows/github_release.yml +++ b/.github/workflows/github_release.yml @@ -7,6 +7,8 @@ on: jobs: create-release: + # Snapshot tags are never releases. + if: ${{ !endsWith(github.ref_name, '-SNAPSHOT') }} runs-on: ubuntu-latest permissions: @@ -14,14 +16,38 @@ jobs: steps: - name: Checkout Code - uses: actions/checkout@v4 + uses: actions/checkout@v6 - - name: Create GitHub Release with Auto-Generated Notes + # The release notes are the version's section of the changelog. A + # prerelease usually has no section of its own yet, so it gets the + # unreleased one. If neither has anything, fall back to GitHub's + # generated notes rather than publish an empty release. + - name: Extract the release notes from the changelog + id: notes + run: | + extract() { + awk -v heading="$1" ' + /^## / { if (found) exit; found = ($2 == heading); next } + found { print } + ' CHANGELOG.md + } + extract "${GITHUB_REF_NAME#v}" > release-notes.md + if ! grep -q '[^[:space:]]' release-notes.md; then + extract main > release-notes.md + fi + if grep -q '[^[:space:]]' release-notes.md; then + echo "found=true" >> "$GITHUB_OUTPUT" + else + echo "::warning::No changelog section for $GITHUB_REF_NAME, using generated notes instead." + echo "found=false" >> "$GITHUB_OUTPUT" + fi + + - name: Create GitHub Release uses: ncipollo/release-action@v1 with: tag: ${{ github.ref_name }} name: clojure-ts-mode ${{ github.ref_name }} prerelease: ${{ contains(github.ref, '-rc') || contains(github.ref, '-alpha') || contains(github.ref, '-beta') }} - generateReleaseNotes: true # Auto-generate release notes based on PRs and commits - # TODO: Use bodyFile to get the contents from changelog + bodyFile: ${{ steps.notes.outputs.found == 'true' && 'release-notes.md' || '' }} + generateReleaseNotes: ${{ steps.notes.outputs.found != 'true' }} token: ${{ secrets.GITHUB_TOKEN }}