Library Authors - how do you automate building and deployment?

I think the question is pretty self explanatory from the title.
It’s considered bad practice to build and deploy artifacts from a developer’s machine, but from browsing repos in github I’ve only been able to find examples of automated tests, with the exception of Borkdude’s repos (sci example)

Any suggestions or words of wisdom? How do you do it?

2 Likes

I run lein deploy clojars on CircleCI on the master branch when all other steps have passed (most notably the tests). The user and password are configurable as environment variables.

I haven’t yet looked in deps.edn deployments. I usually use both lein and deps.edn in a project.

1 Like

As of now your builds are my only reference points. I’m curious to see if there are other approaches. It isn’t a knock on your methods, I’m just not familiar enough with the available options to be able to judge

I know there’s options for deps.edn that would not be very different.

1 Like

I suspect that is, in part, due to freely-available CI being a relatively recent phenomenon so a lot of Clojure projects got started before the machinery was widely available?

Also, documentation around Leiningen talks about running lein deploy clojars (manually) but doesn’t talk about how to do it on CircleCI or GitHub Actions (the latter being an even more recent development).

In addition, many projects don’t publish snapshots anyway so having CI publish them is just not something every project maintainer wants to do (I rarely publish snapshots of my OSS projects because I don’t want to encourage folks to depend on them – especially since, with the CLI/deps.edn, folks can depend on a :git/url/:sha to pull any version directly from GitHub).

And I guess that brings us full circle to one of the driving ideas behind some of what tools.deps.alpha brings to the table: the ability to depend on local and git versions of projects without needing artifacts published to a third-party location. Rich has talked about the potential problems with versioned artifacts in Spec-ulation (transcript) and I think Alex Miller has also given a conference talk that touches on some that…

1 Like

Brief update:
Ended up replicating @borkdude’s build setup. Everything was simple and painless besides one stumbling block:
When configuring environment variables for username and password with :env/user, the variable which will be looked up in the environment is upper cased, USER.
Thank you for the input :slight_smile:

1 Like

Although you were asking specifically about libraries, there might be some interest in my most complicated automatic build, which is of a Clojure program which I release as a signed, notarized Mac application and a Windows installer as well as the usual cross-platform executable Jar file. I was able to get that all automated using GitHub Actions. There was a lot of research and trial-and-error required, especially in the Apple build tools, but I was very impressed that GitHub enabled me to fully implement this process from pushing a commit to having the build artifacts published in their Actions framework, including securely managing my private keys and certificates.

1 Like