Skip to content

Commit

Permalink
fix: install script gets the latest release
Browse files Browse the repository at this point in the history
  • Loading branch information
adikari committed Oct 4, 2022
1 parent d89a687 commit 2580270
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ jobs:
registry-url: 'https://registry.npmjs.org'

- name: Publish to npm
run: npm publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@adikari/safebox",
"version": "1.1.0",
"version": "1.1.1",
"description": "A Fast and Flexible secret manager built with love by adikari in Go",
"main": "index.js",
"scripts": {
Expand Down
14 changes: 9 additions & 5 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,18 @@
# option. This file may not be copied, modified, or distributed
# except according to those terms.

# Example to bypass binary overwrite [y/N] prompt
# curl -sSL https://raw.githubusercontent.com/adikari/safebox/main/scripts/install.sh | sh

set -u

BINARY_DOWNLOAD_PREFIX="https://github.com/adikari/safebox/releases/download"
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" |
grep '"tag_name":' |
sed -E 's/.*"([^"]+)".*/\1/'
}

PACKAGE_VERSION="1.0.1"
BINARY_DOWNLOAD_PREFIX="https://github.com/adikari/safebox/releases/download"
PACKAGE_VERSION=$(get_latest_release adikari/safebox)

download_binary_and_run_installer() {
downloader --check
Expand All @@ -39,8 +43,8 @@ download_binary_and_run_installer() {
esac

local _current_dir=$(pwd)
local _tardir="safebox_$PACKAGE_VERSION"_"${_arch}"
local _url="$BINARY_DOWNLOAD_PREFIX/v$PACKAGE_VERSION/${_tardir}.tar.gz"
local _tardir="safebox_${PACKAGE_VERSION:1}"_"${_arch}"
local _url="$BINARY_DOWNLOAD_PREFIX/$PACKAGE_VERSION/${_tardir}.tar.gz"
local _dir="$(mktemp -d 2>/dev/null || ensure mktemp -d -t test)"
local _file="$_dir/input.tar.gz"
local _safebox="$_dir/safebox$_ext"
Expand Down

0 comments on commit 2580270

Please sign in to comment.