diff --git a/scripts/install.sh b/scripts/install.sh index d405cd1..8903174 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -24,13 +24,7 @@ download_binary_and_run_installer() { need_cmd rmdir need_cmd unzip - if [ -z ${VERSION} ]; then - # VERSION is either not set or empty - DOWNLOAD_VERSION=$PACKAGE_VERSION - else - # VERSION set and not empty - DOWNLOAD_VERSION=$VERSION - fi + DOWNLOAD_VERSION=$PACKAGE_VERSION local _tardir="librarian-$DOWNLOAD_VERSION" local _url="$BINARY_DOWNLOAD_PREFIX/v$DOWNLOAD_VERSION/${_tardir}.zip" @@ -51,7 +45,7 @@ download_binary_and_run_installer() { exit 1 fi - ensure unzip "$_file" -d "$_tmpdir" + ensure unzip -q "$_file" -d "$_tmpdir" ensure rm -rf "$_installdir" ensure mv "$_tmpdir/librarian-$PACKAGE_VERSION" "$_installdir" diff --git a/setup-librarian/action.yml b/setup-librarian/action.yml index 9684d46..2ee54e0 100644 --- a/setup-librarian/action.yml +++ b/setup-librarian/action.yml @@ -5,7 +5,6 @@ runs: using: 'composite' steps: - run: | - ../scripts/install.sh + ${{ github.action_path }}/../scripts/install.sh echo "$HOME/.librarian/bin" >> $GITHUB_PATH - librarian --version shell: bash diff --git a/setup-librarian/index.js b/setup-librarian/index.js deleted file mode 100644 index 550a733..0000000 --- a/setup-librarian/index.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Most of this code has been copied from the following GitHub Action - * to make it simpler or not necessary to install a lot of - * JavaScript packages to execute a shell script. - * - * https://github.com/ad-m/github-push-action/blob/fe38f0a751bf9149f0270cc1fe20bf9156854365/start.js - */ - -const spawn = require('child_process').spawn; -const path = require("path"); - -const exec = (cmd, args=[]) => new Promise((resolve, reject) => { - console.log(`Started: ${cmd} ${args.join(" ")}`) - const app = spawn(cmd, args, { stdio: 'inherit' }); - app.on('close', code => { - if(code !== 0){ - err = new Error(`Invalid status code: ${code}`); - err.code = code; - return reject(err); - }; - return resolve(code); - }); - app.on('error', reject); -}); - -const main = async () => { - await exec('kotlin', [path.join(__dirname, './prepare-release.main.kts')]); -}; - -main().catch(err => { - console.error(err); - console.error(err.stack); - process.exit(err.code || -1); -}) \ No newline at end of file diff --git a/setup-librarian/install-librarian.main.kts b/setup-librarian/install-librarian.main.kts deleted file mode 100644 index c64fc96..0000000 --- a/setup-librarian/install-librarian.main.kts +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env kotlin - -@file:DependsOn("com.gradleup.librarian:core:0.0.3") - -import com.gradleup.librarian.core.tooling.commitRelease - - -fun getInput(name: String): String { - return getOptionalInput(name) ?: error("Cannot find an input for $name") -} - -fun getOptionalInput(name: String): String? { - return System.getenv("INPUT_${name.uppercase()}")?.ifBlank { - null - } -} - -runCommand("git", "config", "user.name", "librarian[bot]") -runCommand("git", "config", "user.email", "librarian[bot]@users.noreply.github.com") - -commitRelease(getInput("versionToRelease")) - -private fun runCommand(vararg args: String) { - ProcessBuilder() - .inheritIO() - .command(*args) - .start() - .waitFor() - .let { - check(it == 0) { - "Cannot execute '${args.joinToString(" ")}': $it" - } - } -}