diff --git a/README.md b/README.md new file mode 100644 index 0000000..1dc8f46 --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# Leiningen packaging for sdkman.io + +## Prerequisites + + * A Leiningen release (online) + * wget + * zip + * sdkman credentials + +## Packaging + +``` +./package.sh VERSION BUILD_DIR +``` + + * `BUILD_DIR needs to be empty` + * this yields a `zip` file in `BUILD_DIR/out/` + +## Uploading + + * Release this zip file in the `leiningen/leiningen-sdkman` repo and jot down the URL + +## Releasing + +``` +export CONSUMER_KEY=x +export CONSUMER_TOKEN=y + +./release.sh VERSION +``` diff --git a/package.sh b/package.sh new file mode 100755 index 0000000..f3e52a5 --- /dev/null +++ b/package.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +if [ "$1" = "" -o "$2" = "" ]; then + echo "Usage: $0 VERSION BUILD_DIR" + exit +fi + +VERSION="$1" +BUILD_DIR="$2" +SUB_DIR="leiningen-${VERSION}" +OUT_DIR="out" + +test -d "$BUILD_DIR" && { + echo "The build dir ${BUILD_DIR} exists, choose a different dir." + exit 1 +} + +echo "Packaging Leiningen ${VERSION} for SDKMAN in ${BUILD_DIR} ..." + +mkdir -p "$BUILD_DIR" +cd "$BUILD_DIR" + +test -d "$SUB_DIR" || mkdir -p "$SUB_DIR" +cd "$SUB_DIR" + +mkdir bin +cd bin + +wget "https://raw.githubusercontent.com/technomancy/leiningen/${VERSION}/bin/lein-sdkman" -O "lein" +wget "https://raw.githubusercontent.com/technomancy/leiningen/${VERSION}/bin/lein.bat" -O "lein.bat" + +cd .. +mkdir lib +cd lib + +wget "https://github.com/technomancy/leiningen/releases/download/${VERSION}/leiningen-${VERSION}-standalone.zip" -O "leiningen-${VERSION}-standalone.jar" + +cd ../.. +test -d "$OUT_DIR" || mkdir -p "$OUT_DIR" + +FILE_NAME="${OUT_DIR}/${SUB_DIR}.zip" + +zip "FILE_NAME" "$SUB_DIR" + +echo "Leiningen ${VERSION} was packaged to ${FILE_NAME}" + + diff --git a/release.sh b/release.sh new file mode 100755 index 0000000..be36ea9 --- /dev/null +++ b/release.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +if [ "$1" = "" ]; then + echo "Usage: $0 VERSION" + exit +fi + +VERSION="$1" +URL="https://github.com/leiningen/leiningen-sdkman/releases/download/${VERSION}/leiningen-${VERSION}.zip" + +curl -X POST \ +-H "Consumer-Key: ${CONSUMER_KEY}" \ +-H "Consumer-Token: ${CONSUMER_TOKEN}" \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-d "{\"candidate\": \"leiningen\", \"version\": \"${VERSION}\", \"url\": \"${URL}\"}" \ +https://vendors.sdkman.io/release