File: release

package info (click to toggle)
leiningen-clojure 2.11.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,124 kB
  • sloc: xml: 925; sh: 776; lisp: 46; makefile: 45; java: 16
file content (101 lines) | stat: -rwxr-xr-x 3,024 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash

if [ "$1" = "" ]; then
    echo "usage: $0 VERSION"
    exit 1
fi

set -e -u

RELEASE_VERSION=$1
CURRENT_VERSION="$RELEASE_VERSION-SNAPSHOT"
LEIN_STABLE=$2

if [ "$LEIN_STABLE" = "" ]; then
    LEIN_STABLE=lein-stable
fi

# Would like to use `lein release` here, but we don't have a way to
# update the bash scripts or watch for boot slowdowns that way. Maybe
# try adding lein-shell?

if [ ! -x `which $LEIN_STABLE` ]; then
    echo "Install a stable version of Leiningen as $LEIN_STABLE."
    exit 1
fi

grep $RELEASE_VERSION NEWS.md || (echo "Add $RELEASE_VERSION to NEWS.md" && exit 1)

lein vcs assert-committed

for f in bin/lein bin/lein-pkg bin/lein.bat bin/lein.ps1 project.clj leiningen-core/project.clj; do
    sed -i s/$CURRENT_VERSION/$RELEASE_VERSION/ $f
done

rm -rf target classes leiningen-core/target leiningen-core/classes leiningen-core/lib
rm -rf $HOME/.lein/self-installs/leiningen-$RELEASE_VERSION-standalone.jar

LEIN_ROOT=$PWD

echo "Bootstrapping..."
cd leiningen-core
$LEIN_STABLE do clean, bootstrap
cd ..

echo "Generating uberjar..."

bin/lein uberjar
RELEASE_JAR=$PWD/target/leiningen-$RELEASE_VERSION-standalone.jar
RELEASE_JAR_CHECKSUM="$(sha256sum $RELEASE_JAR | awk '{ print $1 }')"
SELF_INSTALL_JAR=$HOME/.lein/self-installs/$(basename $RELEASE_JAR)
mkdir -p $HOME/.lein/self-installs
cp $RELEASE_JAR $SELF_INSTALL_JAR

sed -i "s/export LEIN_CHECKSUM=.*/export LEIN_CHECKSUM='$RELEASE_JAR_CHECKSUM'/" bin/lein
cp bin/lein /tmp/lein-$RELEASE_VERSION
cd /tmp

if [ ! -r test-project ]; then
    ./lein-$RELEASE_VERSION new test-project
fi

cd test-project

echo "Running a few invocations in order to check boot time..."

time ../lein-$RELEASE_VERSION run -m clojure.main/main -e nil
time ../lein-$RELEASE_VERSION run -m clojure.main/main -e nil
time ../lein-$RELEASE_VERSION run -m clojure.main/main -e nil

echo "Check that these are about the same boot times as with the last version."
echo "Run this in a project: time $LEIN_STABLE run -m clojure.main/main -e nil"
echo "Proceeding here will publish the new version to the git repo."
echo "Are these acceptable times? (~3s) [Y\n]"
read CONTINUE
case "$CONTINUE" in
    y|Y|"")
        gpg -ab $RELEASE_JAR;;
    *)
        echo "Aborted."
        exit 1;;
esac

cd $LEIN_ROOT

git commit -a -m "Release $RELEASE_VERSION"
git tag -s $RELEASE_VERSION -m "Release $RELEASE_VERSION"
git push && git push --tags && git push origin main:stable

echo "Upload to Codeberg and Github:"
echo "    $SELF_INSTALL_JAR"
echo "    $SELF_INSTALL_JAR.asc"
echo
echo "https://codeberg.org/leiningen/leiningen/releases/new?tag=$RELEASE_VERSION"
echo "https://github.com/technomancy/leiningen/releases/new?tag=$RELEASE_VERSION"
echo "Copy this version's section of NEWS.md to the release description."

rm -rf target leiningen-core/target
echo "Test self-install. If things are good, run this:"
echo "    lein deploy clojars && cd leiningen-core && lein deploy clojars"
echo ""
echo "Then run: bin/bump $RELEASE_VERSION NEXT_VERSION-SNAPSHOT"