Skip to content

Commit e0a7852

Browse files
committedMar 22, 2024
Automate publishing of tagged releases to Clojars
So that we don't need to find credentials and remember how to release changes manually. Git tags are used to trigger publishing so that we don't re-publish over existing versions every time we merge to master. It also means that we're more likely to remember to tag and don't need to add any logic or credentials for the workflow to create tags. An alternative would have been to use the build number as a patch version, but it's unwieldy for both for users and for us to maintain the versions in `README.md` and `CHANGELOG.md`. The `CLOJARS_USERNAME` and `CLOJARS_TOKEN` environment variables come from a context. The project already has "build forks" and "pass secrets to fork builds" disabled, which will prevent leaking these credentials.
1 parent 867b433 commit e0a7852

File tree

4 files changed

+44
-5
lines changed

4 files changed

+44
-5
lines changed
 

‎.circleci/config.yml

+19-1
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,28 @@ jobs:
2828
- run: lein check
2929
- run: lein test
3030

31+
publish:
32+
<<: *defaults
33+
steps:
34+
- checkout
35+
- run: lein deps
36+
- run: lein deploy
37+
3138
workflows:
3239
version: 2
33-
build_and_test:
40+
test_and_publish:
3441
jobs:
3542
- clj-kondo
3643
- docs
3744
- test
45+
- publish:
46+
context: clojars-publish
47+
requires:
48+
- clj-kondo
49+
- docs
50+
- test
51+
filters:
52+
tags:
53+
only: /.*/
54+
branches:
55+
ignore: /.*/

‎CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Version NEXT
1+
Version 0.10.0 (March 22, 2024)
22
================================
33

44
* [#25](https://github.com/circleci/analytics-clj/pull/25): Update CODEOWNERS with more relevant team

‎README.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ For full documentation on the Segment.io 2.x Java client, see [analytics-java](h
1010

1111
## Installation
1212

13-
`[circleci/analytics-clj "0.8.2"]`
13+
`[circleci/analytics-clj "<VERSION>"]`
14+
15+
To find the most recent published version, see https://clojars.org/circleci/analytics-clj
1416

1517
## Usage
1618

@@ -102,6 +104,16 @@ We provided a top level `enqueue` function to allow you to do the following:
102104
(.properties {"company" "Acme Inc."})))
103105
```
104106

107+
108+
## Releasing
109+
110+
New git tags are automatically published to [clojars](https://clojars.org/circleci/bond).
111+
112+
The following should be updated on the main/master branch before tagging:
113+
114+
- `project.clj` - version
115+
- `CHANGELOG.md` - summary of changes
116+
105117
## License
106118

107119
Copyright © 2019 CircleCI

‎project.clj

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(defproject circleci/analytics-clj "0.8.2"
1+
(defproject circleci/analytics-clj "0.10.0"
22
:description "Idiomatic Clojure wrapper for the Segment.io 2.x Java client"
33
:url "https://github.com/circleci/analytics-clj"
44
:license {:name "Eclipse Public License"
@@ -9,4 +9,13 @@
99
:profiles {:dev {:dependencies [[bond "0.2.6"]]}}
1010
:plugins [[lein-codox "0.10.8"]]
1111
:codox {:output-path "docs"
12-
:namespaces [circleci.analytics-clj.core]})
12+
:namespaces [circleci.analytics-clj.core]}
13+
14+
:repositories [["releases" {:url "https://clojars.org/repo"
15+
:username :env/clojars_username
16+
:password :env/clojars_token
17+
:sign-releases false}]
18+
["snapshots" {:url "https://clojars.org/repo"
19+
:username :env/clojars_username
20+
:password :env/clojars_token
21+
:sign-releases false}]])

0 commit comments

Comments
 (0)
Failed to load comments.