Skip to content

Commit b41bcbf

Browse files
authored
maint: prep for next release (#23)
Move to 1.1.<release count> version scheme. Move to using neil to track version within `deps.edn`. I don't necessarily think this is better than the old `version.edn`, but it is consistent with what I've done on my other projects. Tweak changelog - move to [breaking] [minor breaking] attributes on release header scheme I've used on other projects - automatically add yyyy-mm-dd date to release header - describe commits for release link as "commit log" Add GitHub release creation to release workflow. Stick with release initiated through GitHub UI on release workflow. I still feel this is much simpler than a version tag triggered release.
1 parent b8920e8 commit b41bcbf

File tree

13 files changed

+317
-276
lines changed

13 files changed

+317
-276
lines changed

.github/workflows/release.yml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -56,27 +56,22 @@ jobs:
5656
- name: Download Clojure Dependencies
5757
run: bb download-deps
5858

59-
- name: Release Prep (step 1 of 4)
59+
- name: Release Prep (step 1 of 5)
6060
run: bb ci-release prep
6161

62-
- name: Release Deploy (step 2 of 4)
62+
- name: Release Deploy (step 2 of 5)
6363
env:
6464
CLOJARS_USERNAME: ${{ secrets.CLOJARS_USERNAME }}
6565
CLOJARS_PASSWORD: ${{ secrets.CLOJARS_PASSWORD }}
6666
run: bb ci-release deploy-remote
6767

68-
- name: Release Commit (step 3 of 4)
68+
- name: Release Commit (step 3 of 5)
6969
run: bb ci-release commit
7070

71-
- name: Make GitHub Actions aware of target version tag
72-
run: echo "tag=v$(clojure -T:build built-version)" >> $GITHUB_OUTPUT
73-
id: target-version
74-
75-
- name: Create GitHub release (step 4 of 4)
76-
uses: actions/create-release@v1
71+
- name: Create GitHub Release (step 4 of 5)
7772
env:
78-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79-
with:
80-
tag_name: ${{ steps.target-version.outputs.tag}}
81-
release_name: ${{ steps.target-version.outputs.tag}}
82-
commitish: main
73+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
run: bb ci-release create-github-release
75+
76+
- name: Inform Cljdoc (step 5 of 5)
77+
run: bb ci-release inform-cljdoc

CHANGELOG.adoc

Lines changed: 43 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,118 @@
11
// NOTE: release process automatically updates titles with "Unreleased" to title with actual release version
22
= Change Log
33

4-
For a list of breaking changes see link:#breaking[breaking-changes]
4+
[.normal]
5+
A release with known breaking changes is marked with:
56

6-
// Release workflow will:
7-
// - Fail if there is no "== Unreleased" section header
8-
// - Helpfully fail when the section contains no descriptive text
9-
// - Replace the Unreleased section header with actual release version
10-
// - Prepend a new Unreleased section header
7+
* [breaking] you probably need to change your code
8+
* [minor breaking] you likely don't need to change your code
9+
10+
// DO NOT EDIT: the "Unreleased" section header is automatically updated by the release workflow
11+
// which will fail on any of:
12+
// - unreleased section not found,
13+
// - unreleased section empty
14+
// - optional attribute is not [breaking] or [minor breaking]
15+
// (adjust these in ci_relase.clj as you see fit)
1116

1217
== Unreleased
1318

19+
* Drop `alpha` status, we don't have many users, but folks have been using this lib for years
20+
* Reviewed and refreshed docs
1421
* Bumped library deps (these are used during test generation only)
15-
* No longer engaging clj-kondo's lint feature during code analysis.
22+
* No longer engaging clj-kondo's lint feature during code analysis
1623

17-
== v1.0.166-alpha
24+
== v1.0.166-alpha - 2021-11-27 [[v1.0.166-alpha]]
1825

1926
* While preserving our existing `-X` command line interface, add a more conventional main command line interface to support leiningen (and potentially Windows) users https://github.com/lread/test-doc-blocks/issues/8[#8]
2027
* Now failing when a requested file/glob does not exist https://github.com/lread/test-doc-blocks/issues/9[#9]
2128
* Bump deps
2229
* Internal test-doc-blocks developer facing:
2330
** Migrate from `depstar` to `tools.build`
2431

25-
https://github.com/lread/test-doc-blocks/compare/v1.0.146-alpha\...v1.0.166-alpha[Gritty details of changes for this release]
32+
https://github.com/lread/test-doc-blocks/compare/v1.0.146-alpha\...v1.0.166-alpha[commit log]
2633

27-
== v1.0.146-alpha
34+
== v1.0.146-alpha - 2021-08-30 [[v1.0.146-alpha]]
2835

2936
* Add support for `(refer-clojure ...)` in doc blocks https://github.com/lread/test-doc-blocks/issues/5[#5]
3037
* Bump rewrite-clj to v1.0.682-alpha
3138

32-
https://github.com/lread/test-doc-blocks/compare/v1.0.137-alpha\...v1.0.146-alpha[Gritty details of changes for this release]
39+
https://github.com/lread/test-doc-blocks/compare/v1.0.137-alpha\...v1.0.146-alpha[commit log]
3340

34-
== v1.0.137-alpha
41+
== v1.0.137-alpha - 2021-08-23 [[v1.0.137-alpha]]
3542

3643
* Freshen up docs, deps and internal scripts
3744

38-
https://github.com/lread/test-doc-blocks/compare/v1.0.129-alpha\...v1.0.137-alpha[Gritty details of changes for this release]
45+
https://github.com/lread/test-doc-blocks/compare/v1.0.129-alpha\...v1.0.137-alpha[commit log]
3946

40-
== v1.0.129-alpha
47+
== v1.0.129-alpha - 2021-04-16 [[v1.0.129-alpha]]
4148

4249
* Maintenance release - bump deps
4350

44-
https://github.com/lread/test-doc-blocks/compare/v1.0.124-alpha\...v1.0.129-alpha[Gritty details of changes for this release]
51+
https://github.com/lread/test-doc-blocks/compare/v1.0.124-alpha\...v1.0.129-alpha[commit log]
4552

46-
== v1.0.124-alpha
53+
== v1.0.124-alpha - 2021-03-26 [[v1.0.124-alpha]]
4754

4855
* Maintenance release - deps, docs and ops updates
4956

50-
https://github.com/lread/test-doc-blocks/compare/v1.0.116-alpha\...v1.0.124-alpha[Gritty details of changes for this release]
57+
https://github.com/lread/test-doc-blocks/compare/v1.0.116-alpha\...v1.0.124-alpha[commit log]
5158

52-
== v1.0.116-alpha
59+
== v1.0.116-alpha - 2021-03-17 [[v1.0.116-alpha]]
5360

5461
* Switch to `com.github.lread/test-doc-blocks` for deployment artifact name as per new security measures at clojars.
5562

56-
https://github.com/lread/test-doc-blocks/compare/v1.0.114-alpha\...v1.0.116-alpha[Gritty details of changes for this release]
63+
https://github.com/lread/test-doc-blocks/compare/v1.0.114-alpha\...v1.0.116-alpha[commit log]
5764

58-
== v1.0.114-alpha
65+
== v1.0.114-alpha - 2021-03-14 [[v1.0.114-alpha]]
5966

6067
* Ensure test-doc-blocks works on Windows
6168

62-
https://github.com/lread/test-doc-blocks/compare/v1.0.107-alpha\...v1.0.114-alpha[Gritty details of changes for this release]
69+
https://github.com/lread/test-doc-blocks/compare/v1.0.107-alpha\...v1.0.114-alpha[commit log]
6370

64-
== v1.0.107-alpha
71+
== v1.0.107-alpha - 2021-03-13 [[v1.0.107-alpha]]
6572

6673
* Support generating tests from CommonMark code blocks found in Clojure source docstrings
6774

68-
https://github.com/lread/test-doc-blocks/compare/v1.0.103-alpha\...v1.0.107-alpha[Gritty details of changes for this release]
75+
https://github.com/lread/test-doc-blocks/compare/v1.0.103-alpha\...v1.0.107-alpha[commit log]
6976

70-
== v1.0.103-alpha
77+
== v1.0.103-alpha - 2021-03-12 [[v1.0.103-alpha]]
7178

7279
* Correct sort order in new tree-like report of found blocks
7380

74-
https://github.com/lread/test-doc-blocks/compare/v1.0.101-alpha\...v1.0.103-alpha[Gritty details of changes for this release]
81+
https://github.com/lread/test-doc-blocks/compare/v1.0.101-alpha\...v1.0.103-alpha[commit log]
7582

76-
== v1.0.101-alpha
83+
== v1.0.101-alpha - 2021-03-11 [[v1.0.101-alpha]]
7784

7885
* Don't trim trailing newline for test body if last item is comment
7986
* Switch from (too) wide table to tree-like report of found blocks
8087

81-
https://github.com/lread/test-doc-blocks/compare/v1.0.92-alpha\...v1.0.101-alpha[Gritty details of changes for this release]
88+
https://github.com/lread/test-doc-blocks/compare/v1.0.92-alpha\...v1.0.101-alpha[commit log]
8289

83-
== v1.0.92-alpha
90+
== v1.0.92-alpha - 2021-03-11 [[v1.0.92-alpha]]
8491

8592
* Upgraded from rewrite-clj v0 to rewrite-clj v1
8693
* Release workflow now creates a GitHub release
8794

88-
https://github.com/lread/test-doc-blocks/compare/v1.0.85-alpha\...v1.0.92-alpha[Gritty details of changes for this release]
95+
https://github.com/lread/test-doc-blocks/compare/v1.0.85-alpha\...v1.0.92-alpha[commit log]
8996

90-
== v1.0.85-alpha
97+
== v1.0.85-alpha - 2021-02-06 [[v1.0.85-alpha]]
9198

9299
* Correct public API for cljdoc
93100

94-
https://github.com/lread/test-doc-blocks/compare/v1.0.82-alpha\...v1.0.85-alpha[Gritty details of changes for this release]
101+
https://github.com/lread/test-doc-blocks/compare/v1.0.82-alpha\...v1.0.85-alpha[commit log]
95102

96-
== v1.0.82-alpha
103+
== v1.0.82-alpha - 2021-02-06 [[v1.0.82-alpha]]
97104

98105
* Developer facing only: more updates to release workflow
99106

100-
https://github.com/lread/test-doc-blocks/compare/v1.0.80-alpha\...v1.0.82-alpha[Gritty details of changes for this release]
107+
https://github.com/lread/test-doc-blocks/compare/v1.0.80-alpha\...v1.0.82-alpha[commit log]
101108

102-
== v1.0.80-alpha
109+
== v1.0.80-alpha - 2021-02-06 [[v1.0.80-alpha]]
103110

104111
* Developer facing only: updates to release workflow
105112

106-
https://github.com/lread/test-doc-blocks/compare/v1.0.76-alpha\...v1.0.80-alpha[Gritty details of changes for this release]
113+
https://github.com/lread/test-doc-blocks/compare/v1.0.76-alpha\...v1.0.80-alpha[commit log]
107114

108-
== v1.0.76-alpha
115+
== v1.0.76-alpha - 2021-02-05 [[v1.0.72-alpha]]
109116

110117
* First release
111118

112-
[#breaking]
113-
== Breaking Changes
114-
115-
// Release workflow will:
116-
// - If an "=== Unreleased Breaking Changes" section header exists here:
117-
// - Helpfully fail the section contains no descriptive text
118-
// - Replace the Unreleased section header with actual release version
119-
120-
Still in alpha, nothing to track yet!
121-
122-
// === Unreleased Breaking Changes

README.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ toc::[]
2727

2828
== Status
2929

30-
Alpha - early adopters and feedback welcome!
30+
Folks have been using test-doc-blocks for years without issue.
3131

3232
== Rationale
3333
I wanted to make sure the code examples I provided in rewrite-clj v1 documentation do not mislead and function as expected for those who dare to try them.
@@ -49,11 +49,11 @@ Have an update? Let us know!
4949

5050
== Versioning
5151

52-
Test-doc-block versioning scheme is: `major`.`minor`.`patch`-`test-qualifier`
52+
Test-doc-block versioning scheme is: `major`.`minor`.`release`-`test-qualifier`
5353

5454
* `major` increments when the API has been broken - something, as a rule, we'd like to avoid.
5555
* `minor` increments to convey significant new features have been added.
56-
* `patch` indicates bug fixes - it is the number of commits in the repo.
56+
* `release` starting with v1.1, the test-doc-blocks release count over the life of test-doc-blocks.
5757
* `test-qualifier` is absent for stable releases. Can be `alpha`, `beta`, `rc1`, etc.
5858

5959
== People

bb.edn

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{:min-bb-version "0.3.7"
2-
:paths ["script"]
2+
:paths ["script" "build"]
33
:deps {lread/status-line {:git/url "https://github.com/lread/status-line.git"
44
:sha "cf44c15f30ea3867227fa61ceb823e5e942c707f"}
55
dev.nubank/docopt {:mvn/version "0.6.1-fix7"}
66
version-clj/version-clj {:mvn/version "2.0.2"}
7-
etaoin/etaoin {:mvn/version "1.0.40"}}
8-
7+
etaoin/etaoin {:mvn/version "1.0.40"}
8+
io.github.babashka/neil {:git/tag "v0.3.65" :git/sha "9a79582"}}
99
:tasks {;; setup
1010
:requires ([babashka.fs :as fs]
1111
[clojure.string :as string]
@@ -115,6 +115,9 @@
115115
cljdoc-preview {:doc "preview what docs will look like on cljdoc, use --help for args"
116116
:task cljdoc-preview/-main}
117117

118+
;; let's not rely on a random version of neil
119+
neil {:task babashka.neil/-main :doc "Pinned version of babashka/neil (used in scripting)"}
120+
118121
ci-test {:doc "run continuous integration service tests"
119122
:task (when (no-args-check)
120123
(run 'clean)

build.clj

Lines changed: 20 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,25 @@
11
(ns build
2-
(:require [clojure.edn :as edn]
3-
[clojure.java.io :as io]
2+
(:require [build-shared]
3+
[clojure.edn :as edn]
44
[clojure.tools.build.api :as b]))
55

6-
(def lib 'com.github.lread/test-doc-blocks)
7-
(def version (let [version-template (-> "version.edn" slurp edn/read-string)
8-
patch (b/git-count-revs nil)]
9-
(str (:major version-template) "."
10-
(:minor version-template) "."
11-
patch
12-
(cond->> (:qualifier version-template)
13-
true (str "-")))))
6+
(def version (build-shared/lib-version))
7+
(def lib (build-shared/lib-artifact-name))
8+
149
(def class-dir "target/classes")
1510
(def basis (b/create-basis {:project "deps.edn"}))
1611
(def jar-file (format "target/%s.jar" (name lib)))
17-
(def built-jar-version-file "target/built-jar-version.txt")
1812

1913
(defn jar
2014
"Build library jar file.
21-
22-
Also writes built version to target/built-jar-version.txt for easy peasy pickup by any interested downstream operation.
23-
24-
We use the optional :version-suffix to distinguish local installs from production releases.
25-
For example, when preview for cljdoc, we use the suffix: cjdoc-preview."
26-
[{:keys [version-suffix]}]
15+
Supports `:version-override` for local testing, otherwise official version is used.
16+
For example, when testing 3rd party libs against rewrite-clj HEAD we use the suffix: canary."
17+
[{:keys [version-override] :as opts}]
2718
(b/delete {:path class-dir})
2819
(b/delete {:path jar-file})
29-
(let [version (if version-suffix (format "%s-%s" version version-suffix)
30-
version)]
20+
21+
(let [version (or version-override version)]
22+
(println "jarring version" version)
3123
(b/write-pom {:class-dir class-dir
3224
:lib lib
3325
:version version
@@ -49,29 +41,17 @@
4941
:target-dir class-dir})
5042
(b/jar {:class-dir class-dir
5143
:jar-file jar-file})
52-
(spit built-jar-version-file version)))
53-
54-
(defn- built-version* []
55-
(when (not (.exists (io/file built-jar-version-file)))
56-
(throw (ex-info (str "Built jar version file not found: " built-jar-version-file) {})))
57-
(slurp built-jar-version-file))
58-
59-
(defn built-version
60-
;; NOTE: Used by release script and github workflow
61-
"Spit out version of jar built (with no trailing newline).
62-
A separate task because I don't know what build.tools might spit to stdout."
63-
[_]
64-
(print (built-version*))
65-
(flush))
44+
(assoc opts :built-version version)))
6645

6746
(defn install
68-
"Install built jar to local maven repo"
69-
[_]
70-
(b/install {:class-dir class-dir
71-
:lib lib
72-
:version (built-version*)
73-
:basis basis
74-
:jar-file jar-file}))
47+
[opts]
48+
(let [{:keys [built-version]} (jar opts)]
49+
(println "installing version" built-version)
50+
(b/install {:class-dir class-dir
51+
:lib lib
52+
:version built-version
53+
:basis basis
54+
:jar-file jar-file})))
7555

7656
(defn deploy
7757
"Deploy built jar to clojars"
@@ -81,11 +61,6 @@
8161
:artifact jar-file
8262
:pom-file (b/pom-path {:lib lib :class-dir class-dir})}))
8363

84-
(defn project-lib
85-
"Returns project groupid/artifactid"
86-
[_]
87-
(println lib))
88-
8964
(defn download-deps
9065
"Download all deps for all aliases"
9166
[_]

build/build_shared.clj

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
(ns build-shared
2+
"a few things that are both needed by bb script code and build.clj"
3+
(:require [clojure.edn :as edn]))
4+
5+
(defn- project-info []
6+
(-> (edn/read-string (slurp "deps.edn"))
7+
:aliases :neil :project))
8+
9+
(def version-tag-prefix "v")
10+
11+
(defn lib-version []
12+
(-> (project-info) :version))
13+
14+
(defn lib-artifact-name []
15+
(-> (project-info) :name))
16+
17+
(defn lib-github-coords []
18+
(-> (project-info) :github-coords))
19+
20+
(defn version->tag [version]
21+
(str version-tag-prefix version))

deps.edn

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@
88
metosin/malli {:mvn/version "0.16.0"}
99
rewrite-clj/rewrite-clj {:mvn/version "1.1.47"}}
1010

11-
:aliases {;;
11+
:aliases {;; we use babashka/neil for project attributes
12+
;; publish workflow references these values (and automatically bumps patch component of version)
13+
:neil {:project {:version "1.1.18" ;; describes last release and is template for next release
14+
:name com.github.lread/test-doc-blocks
15+
;; not neilisms - could potentially conflict with new neilisms
16+
:github-coords lread/test-doc-blocks}}
17+
18+
;;
1219
;; Clojure versions we support
1320
;; min for generation is v1.9
1421
;; min for running generated v1.8
@@ -77,6 +84,7 @@
7784
;; Deployment
7885
;;
7986
:build {:deps {io.github.clojure/tools.build {:mvn/version "0.10.1"}}
87+
:extra-paths ["src" "build"]
8088
:ns-default build}
8189

8290
;; keep deploy deps separate from build deps to avoid download-deps issues

0 commit comments

Comments
 (0)