From 8d34eac77b53a1f8837535f1c52b0cb87415e1e3 Mon Sep 17 00:00:00 2001 From: Will Roden Date: Mon, 25 Nov 2019 13:30:12 -0600 Subject: [PATCH 1/2] rename bin to bindown --- .goreleaser.yml | 4 ++-- Makefile | 22 +++++++++++----------- bootstrapper/main.sh | 4 ++-- bootstrapper/shlib.sh | 2 +- cmd/{bindownloader => bindown}/config.go | 0 cmd/{bindownloader => bindown}/download.go | 0 cmd/{bindownloader => bindown}/main.go | 0 cmd/{bindownloader => bindown}/version.go | 0 script/{bindownloader => bindown} | 4 ++-- script/build-bootstrapper | 14 +++++++------- script/upload-release-bootstrap | 10 +++++----- 11 files changed, 30 insertions(+), 30 deletions(-) rename cmd/{bindownloader => bindown}/config.go (100%) rename cmd/{bindownloader => bindown}/download.go (100%) rename cmd/{bindownloader => bindown}/main.go (100%) rename cmd/{bindownloader => bindown}/version.go (100%) rename script/{bindownloader => bindown} (68%) diff --git a/.goreleaser.yml b/.goreleaser.yml index f75dbd5..f002eb4 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -8,8 +8,8 @@ before: hooks: - script/lint builds: - - id: bindownloader - main: ./cmd/bindownloader + - id: bindown + main: ./cmd/bindown goos: - linux - darwin diff --git a/Makefile b/Makefile index 86642c0..262f8f4 100644 --- a/Makefile +++ b/Makefile @@ -3,24 +3,24 @@ GOBUILD=$(GOCMD) build .PHONY: gobuildcache -bin/bindownloader: gobuildcache - $(GOBUILD) -o $@ ./cmd/bindownloader -bins += bin/bindownloader +bin/bindown: gobuildcache + $(GOBUILD) -o $@ ./cmd/bindown +bins += bin/bindown -bin/golangci-lint: bin/bindownloader - bin/bindownloader download $@ +bin/golangci-lint: bin/bindown + bin/bindown download $@ bins += bin/golangci-lint -bin/gobin: bin/bindownloader - bin/bindownloader download $@ +bin/gobin: bin/bindown + bin/bindown download $@ bins += bin/gobin -bin/goreleaser: bin/bindownloader - bin/bindownloader download $@ +bin/goreleaser: bin/bindown + bin/bindown download $@ bins += bin/goreleaser -bin/semver-next: bin/bindownloader - bin/bindownloader download $@ +bin/semver-next: bin/bindown + bin/bindown download $@ bins += bin/semver-next GOIMPORTS_REF := 8aaa1484dc108aa23dcf2d4a09371c0c9e280f6b diff --git a/bootstrapper/main.sh b/bootstrapper/main.sh index 0c0d9ce..8488735 100644 --- a/bootstrapper/main.sh +++ b/bootstrapper/main.sh @@ -45,7 +45,7 @@ execute() { srcdir="${tmpdir}" (cd "${tmpdir}" && untar "${TARBALL}") test ! -d "${BINDIR}" && install -d "${BINDIR}" - binexe="bindownloader" + binexe="bindown" if [ "$OS" = "windows" ]; then binexe="${binexe}.exe" fi @@ -63,7 +63,7 @@ uname_arch_check "$ARCH" parse_args "$@" VERSION=${TAG#v} -NAME=bindownloader_${VERSION}_${OS}_${ARCH} +NAME=bindown_${VERSION}_${OS}_${ARCH} TARBALL=${NAME}.${FORMAT} TARBALL_URL=${GITHUB_DOWNLOAD}/${TAG}/${TARBALL} diff --git a/bootstrapper/shlib.sh b/bootstrapper/shlib.sh index 09ad425..6f00b00 100644 --- a/bootstrapper/shlib.sh +++ b/bootstrapper/shlib.sh @@ -1,4 +1,4 @@ -##/ this is the part of bootstrap-bindownloader.sh that comes from https://github.com/client9/shlib +##/ this is the part of bootstrap-bindown.sh that comes from https://github.com/client9/shlib ##/ used in script/build-bootstrapper cat /dev/null < dist/bootstrap-bindownloader.sh +# write the dynamic part of bootstrap-bindown.sh +cat << EOF > dist/bootstrap-bindown.sh #!/bin/sh set -e @@ -31,5 +31,5 @@ EOT EOF -cat bootstrapper/shlib.sh | grep -v "^##/" >> dist/bootstrap-bindownloader.sh -cat bootstrapper/main.sh | grep -v "^##/" >> dist/bootstrap-bindownloader.sh +cat bootstrapper/shlib.sh | grep -v "^##/" >> dist/bootstrap-bindown.sh +cat bootstrapper/main.sh | grep -v "^##/" >> dist/bootstrap-bindown.sh diff --git a/script/upload-release-bootstrap b/script/upload-release-bootstrap index 0d169d6..b758d73 100755 --- a/script/upload-release-bootstrap +++ b/script/upload-release-bootstrap @@ -11,17 +11,17 @@ CDPATH="" cd -- "$(dirname -- "$(dirname -- "$0")")" AUTH_HEADER="Authorization: token $GITHUB_TOKEN" -[ -f "dist/bootstrap-bindownloader.sh" ] || { - echo dist/bootstrap-bindownloader.sh is required +[ -f "dist/bootstrap-bindown.sh" ] || { + echo dist/bootstrap-bindown.sh is required exit 1 } -TAG="$(grep "^TAG=" dist/bootstrap-bindownloader.sh | cut -d\" -f2)" +TAG="$(grep "^TAG=" dist/bootstrap-bindown.sh | cut -d\" -f2)" release_id="$(curl -s -H "$AUTH_HEADER" "https://api.github.com/repos/WillAbides/bindownloader/releases/tags/$TAG" | jq .id)" -upload_url="https://uploads.github.com/repos/WillAbides/bindownloader/releases/$release_id/assets?name=bootstrap-bindownloader.sh" +upload_url="https://uploads.github.com/repos/WillAbides/bindownloader/releases/$release_id/assets?name=bootstrap-bindown.sh" echo "$upload_url" -file_content="$(cat dist/bootstrap-bindownloader.sh)" +file_content="$(cat dist/bootstrap-bindown.sh)" curl -X POST -H "$AUTH_HEADER" -H "Content-Type: application/text" -d "$file_content" "$upload_url" From fc79eecd266f4f59939b1b89b6dd2b0397aea410 Mon Sep 17 00:00:00 2001 From: Will Roden Date: Mon, 25 Nov 2019 13:36:44 -0600 Subject: [PATCH 2/2] update build step --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1727963..97028d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,6 @@ jobs: - name: Test run: script/test - name: Build - run: make bin/bindownloader + run: make bin/bindown - name: Lint run: script/lint