Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 60 lines (42 sloc) 1.854 kb
7fe5354 Add build script and POM template for Hudson releases
Stuart Sierra and Russ Olsen authored
1 #!/usr/bin/env bash
2
3 # This script must be run within the ClojureScript top-level project
4 # directory.
5
2a40715 Clean up build script for Hudson
Stuart Sierra and Russ Olsen authored
6 set -ex
7fe5354 Add build script and POM template for Hudson releases
Stuart Sierra and Russ Olsen authored
7
8 cd `dirname $0`/..
9
10 DATE=`date '+%Y%m%d%H%M%S'`
11 WORKING="clojurescript_release_$DATE"
12 mkdir "$WORKING"
13
14 POM_TEMPLATE="pom.template.xml"
15
16 # The command `git describe --match v0.0` will return a string like
17 #
18 # v0.0-856-g329708b
19 #
20 # where 856 is the number of commits since the v0.0 tag. It will always
21 # find the v0.0 tag and will always return the total number of commits (even
22 # if the tag is v0.0.1).
d0ba93c @stuartsierra Prevent local Git replacement from breaking revision numbers
stuartsierra authored
23 REVISION=`git --no-replace-objects describe --match v0.0`
7fe5354 Add build script and POM template for Hudson releases
Stuart Sierra and Russ Olsen authored
24
25 # Extract the version number from the string. Do this in two steps so
26 # it is a little easier to understand.
27 REVISION=${REVISION:5} # drop the first 5 characters
28 REVISION=${REVISION:0:${#REVISION}-9} # drop the last 9 characters
29
30 TAG=r$REVISION
31
32 POM_FILE="$WORKING/clojurescript-0.0-$REVISION.pom"
33 JAR_FILE="$WORKING/clojurescript-0.0-$REVISION.jar"
34
35
36 # `jar cf` errors on duplicate entries,
37 # so we have to assemble the directory manually
38 mkdir "$WORKING/jar_contents"
39
40 cp -R epl-v10.html src/clj/cljs src/cljs/cljs src/cljs/clojure \
41 "$WORKING/jar_contents"
42
43 jar cf "$JAR_FILE" -C "$WORKING/jar_contents" .
44
45 sed -e s/CLOJURESCRIPT_VERSION/0.0-$REVISION/ < "$POM_TEMPLATE" > "$POM_FILE"
46
47 mvn install:install-file -Dfile="$JAR_FILE" -DpomFile="$POM_FILE"
48
49 # For Hudson server
5c8e1d4 @charles-dyfis-net General cleanups for shell wrappers
charles-dyfis-net authored
50 if [ "$HUDSON" = "true" ]; then
7fe5354 Add build script and POM template for Hudson releases
Stuart Sierra and Russ Olsen authored
51 echo "Creating tag $TAG"
17ef534 Enable Git tag/push in Hudson build
Stuart Sierra and Russ Olsen authored
52 git tag -f "$TAG"
53 git push origin "$TAG"
7fe5354 Add build script and POM template for Hudson releases
Stuart Sierra and Russ Olsen authored
54
55 mvn gpg:sign-and-deploy-file -Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ -DrepositoryId=sonatype-nexus-staging -DpomFile="$POM_FILE" -Dfile="$JAR_FILE"
bbc1ae7 Use staging-release instead of staging-promote to avoid infinite loop
Stuart Sierra and Russ Olsen authored
56 mvn nexus:staging-close nexus:staging-release -DtargetRepositoryId=releases -Dnexus.promote.autoSelectOverride=true
7fe5354 Add build script and POM template for Hudson releases
Stuart Sierra and Russ Olsen authored
57 else
58 echo "Skipping Maven deployment and Git push because we are not on Hudson."
59 fi
Something went wrong with that request. Please try again.