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 27fea00..de8085c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,19 +25,19 @@ jobs: - {jdk: 11, clojure: 'master'} - {jdk: 17, clojure: 'master'} steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 + - uses: actions/checkout@v6 + - uses: actions/setup-java@v6 with: distribution: temurin java-version: ${{ matrix.jdk }} - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v7 with: node-version: 'lts/*' - - uses: DeLaGuardo/setup-clojure@12.5 + - uses: DeLaGuardo/setup-clojure@13.7.0 with: cli: latest - name: Cache dependencies - uses: actions/cache@v4 + uses: actions/cache@v6 with: path: | ~/.m2/repository @@ -52,21 +52,21 @@ jobs: name: Lint (clj-kondo + Eastwood) runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 + - uses: actions/checkout@v6 + - uses: actions/setup-java@v6 with: distribution: temurin # Eastwood loads the shadow-cljs dev namespaces, and shadow-cljs 3.x # requires JDK 21. java-version: 21 - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v7 with: node-version: 'lts/*' - - uses: DeLaGuardo/setup-clojure@12.5 + - uses: DeLaGuardo/setup-clojure@13.7.0 with: cli: latest - name: Cache dependencies - uses: actions/cache@v4 + uses: actions/cache@v6 with: path: | ~/.m2/repository @@ -83,20 +83,20 @@ jobs: name: shadow-cljs integration test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 + - uses: actions/checkout@v6 + - uses: actions/setup-java@v6 with: distribution: temurin # shadow-cljs 3.x requires JDK 21. java-version: 21 - - uses: actions/setup-node@v4 + - uses: actions/setup-node@v7 with: node-version: 'lts/*' - - uses: DeLaGuardo/setup-clojure@12.5 + - uses: DeLaGuardo/setup-clojure@13.7.0 with: cli: latest - name: Cache dependencies - uses: actions/cache@v4 + uses: actions/cache@v6 with: path: | ~/.m2/repository @@ -116,12 +116,12 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 + - uses: actions/checkout@v6 + - uses: actions/setup-java@v6 with: distribution: temurin java-version: 21 - - uses: DeLaGuardo/setup-clojure@12.5 + - uses: DeLaGuardo/setup-clojure@13.7.0 with: cli: latest - name: Compute version from tag diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml new file mode 100644 index 0000000..97422df --- /dev/null +++ b/.github/workflows/github-release.yml @@ -0,0 +1,53 @@ +name: Create GitHub Release + +on: + push: + tags: + - "v*" # Trigger when a version tag is pushed (e.g., v1.0.0) + +jobs: + create-release: + # Snapshot tags only exist to exercise the deploy pipeline. + if: ${{ !endsWith(github.ref_name, '-SNAPSHOT') }} + runs-on: ubuntu-latest + + permissions: + contents: write + + steps: + - name: Checkout Code + uses: actions/checkout@v6 + + # 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 "master" > 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: clj-suitable ${{ github.ref_name }} + prerelease: ${{ contains(github.ref, '-rc') || contains(github.ref, '-alpha') || contains(github.ref, '-beta') }} + bodyFile: ${{ steps.notes.outputs.found == 'true' && 'release-notes.md' || '' }} + generateReleaseNotes: ${{ steps.notes.outputs.found != 'true' }} + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/Makefile b/Makefile index 7aac0fa..cc8223d 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,9 @@ -.PHONY: clean test shadow-test install deploy nrepl fig-repl kondo eastwood lint +.PHONY: clean test shadow-test install deploy fig-repl nrepl-figwheel nrepl-shadow kondo eastwood lint check-ci-env VERSION ?= 1.12 +# The version local installs get. Releases take theirs from the git tag. +PROJECT_VERSION ?= 99.99 +export PROJECT_VERSION clean: @-rm -rf target/public/cljs-out \ @@ -11,7 +14,7 @@ clean: .cljs_node_repl \ .rebel_readline_history -test: clean +test: clojure -M:test:test-runner:$(VERSION) # shadow-cljs integration test - needs JDK 21 and a Node runtime (installs the @@ -28,7 +31,7 @@ eastwood: lint: kondo eastwood -install: check-install-env +install: clojure -T:build install deploy: check-ci-env @@ -53,11 +56,7 @@ endif ifndef CLOJARS_PASSWORD $(error CLOJARS_PASSWORD is undefined) endif -ifndef PROJECT_VERSION - $(error PROJECT_VERSION is undefined. Deployments are published from git tags by CI - see .github/workflows/ci.yml.) -endif - -check-install-env: -ifndef PROJECT_VERSION - $(error Please set PROJECT_VERSION as an env var beforehand.) -endif + @if [ "$(PROJECT_VERSION)" = "99.99" ]; then \ + echo "[Error] PROJECT_VERSION is the local default. Deployments are published from git tags by CI - see .github/workflows/ci.yml."; \ + exit 1; \ + fi