https://github.com/bnert-land/publicize
Publish your deps.edn based clojure project to clojars.
https://github.com/bnert-land/publicize
clojure clojure-cli clojure-library deploy-tool
Last synced: 5 days ago
JSON representation
Publish your deps.edn based clojure project to clojars.
- Host: GitHub
- URL: https://github.com/bnert-land/publicize
- Owner: bnert-land
- License: epl-2.0
- Created: 2023-12-26T18:10:15.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-26T19:17:44.000Z (over 2 years ago)
- Last Synced: 2025-10-22T01:36:57.438Z (9 months ago)
- Topics: clojure, clojure-cli, clojure-library, deploy-tool
- Language: Clojure
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# publicize
[](https://clojars.org/land.bnert/publicize)
Micro-library for publishing to clojars from deps.edn + tools.build.
This library is scoped to be for library authors which utilize
tools.build in their workflow.
## Overview
I wanted a more "bare-bones" library for publishing to clojars which
I can hook into `tools.build`. This is "bare-bones" as it get's, given
it is a single function which wraps `pomegranate` and provides some
basic checks against inputs.
If you need extra functionality, or want more of a "batteries included" solution, check out the Alternatives at the bottom of the README.
## Getting Started
### Install
Add dependency to deps.edn `:build` alias (may differ for your project):
```
{:aliases
{:build
{:extra-deps {io.github.clojure/tools.build {:mvn/version "..."}
; Add as an extra dep to :build alias
land.bnert/publicize {:mvn/version "0.4.0"}}
:ns-default build}}}
```
### Usage
Add the following to your `build.clj` file (or the equivalent in your project):
```clojure
(ns build
(:require
[clojure.tools.build.api :as b]
[publicize.core :as p]))
(defn clean [_]
(b/delete {:path "target"}))
(defn jar [_]
(clean nil)
(let [b (b/create-basis {:project "deps.edn"})
; Optional, though recommended.
;
; Will clean clojure version from deps,
; which in turn will exclude the clojure version from the
; generated pom.xml
b (p/clean-clojure-dep b)]
(b/write-pom
{:basis basis
:class-dir "target/classes"
:lib 'myorg.mygroup/mylib
:src-dirs (get basis :paths ["src"])
:version "0.1.0"
:pom-data [[:licenses
[:license
[:name "Name of license"]
[:url "https://..."]]]]}
; Optional
:scm {:url "https://..."})
(b/copy-dir
{:src-dirs (get basis :paths ["src"])
:target-dir "target/classes"})
(b/jar
{:class-dir class-dir
:jar-file "target/mylib.jar"})))
(defn publicize [_]
(let [pom-path (b/pom-path
{:class-dir "", :lib 'myorg.mygroup/mylib})]
(jar nil)
(p/publicize
{:lib 'myorg.mygroup/mylib
:version "0.1.0"
:jar-file "target/mylib.jar"
:pom-path pom-path})))
```
Then, call via cli:
```
$ CLOJARS_USERNAME=... CLOJARS_PASSWORD=... clj -T:build publicize
```
## Alternatives/Prior Work
- [`slipset/deps-deploy`](https://github.com/slipset/deps-deploy)
- More of a "bundled" approach which handles jar packaging for you.
- [`applied-science/deps-library`](https://github.com/applied-science/deps-library)
- Is a super-set of `deps-deploy` with some nifty features (if I am interpretting the README correctly). Check it out if you need more functionailty than what is here.