Skip to content

Commit 0a76461

Browse files
committed
Deploy to Clojars as well as GitHub
1 parent 8ae7ee5 commit 0a76461

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# clj-libssh2
22

3+
![](https://clojars.org/clj-libssh2/latest-version.svg)
4+
35
A Clojure wrapper around [libssh2](http://www.libssh2.org/). There are three
46
parts to this library:
57

project.clj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
:pedantic? :abort
77
:dependencies [[org.clojure/clojure "1.7.0"]
88
[net.n01se/clojure-jna "1.0.0"]]
9+
:deploy-repositories ^:replace [["clojars" {:url "https://clojars.org/repo"
10+
:username [:gpg :env/clojars_username]
11+
:password [:gpg :env/clojars_password]
12+
:sign-releases false}]]
913
:jvm-opts ["-Xmx1g"
1014
"-XX:+TieredCompilation"
1115
"-XX:TieredStopAtLevel=1"])

release.sh

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ set -o nounset
55
export GITHUB_USER=conormcd
66
export GITHUB_REPO=clj-libssh2
77

8+
abort() {
9+
echo "$@"
10+
exit 1
11+
}
12+
813
current_version() {
914
grep -m1 '(defproject' project.clj | \
1015
sed -e 's,^.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$,\1,'
@@ -115,15 +120,29 @@ github_release() {
115120
done
116121
}
117122

123+
clojars_deploy() {
124+
lein deploy clojars 2>&1 | sed -e 's,^, ,'
125+
}
126+
118127
v=$(new_version)
119128
update_project_clj "${v}"
120129
build_jars
121130
save_artifacts
122131
if [ "$(branch)" = "master" ]; then
123-
# TODO: Make the lack of a GitHub token fatal.
124-
if [ -n "${GITHUB_TOKEN:-}" ]; then
125-
ensure_github_release_tool_installed
126-
github_release "${v}"
132+
if [ -z "${CLOJARS_USERNAME:-}" ]; then
133+
abort "Missing environment variable: CLOJARS_USERNAME"
127134
fi
128-
# TODO: Push to clojars
135+
if [ -z "${CLOJARS_PASSWORD:-}" ]; then
136+
abort "Missing environment variable: CLOJARS_PASSWORD"
137+
fi
138+
if [ -z "${GITHUB_TOKEN:-}" ]; then
139+
abort "Missing environment variable: GITHUB_TOKEN"
140+
fi
141+
142+
# Make a GitHub release
143+
ensure_github_release_tool_installed
144+
github_release "${v}"
145+
146+
# Push to clojars
147+
clojars_deploy
129148
fi

0 commit comments

Comments
 (0)