Skip to content

Commit

Permalink
Prepare release toolsets
Browse files Browse the repository at this point in the history
  • Loading branch information
yuuki committed Nov 10, 2019
1 parent 05415e0 commit 8f856fb
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 0 deletions.
Empty file added CHANGELOG.md
Empty file.
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,14 @@ check:
aligncheck ./... || true
structcheck ./... || true
varcheck ./... || true

.PHONY: crossbuild
crossbuild: devel-deps credits
$(eval ver = $(shell gobump show -r))
goxz -pv=v$(ver) -os=linux -arch=386,amd64 -build-ldflags="$(RELEASE_BUILD_LDFLAGS)" \
-d=./dist/v$(ver)

.PHONY: release
release: devel-deps
_tools/release
_tools/upload_artifacts
39 changes: 39 additions & 0 deletions _tools/credits
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
set -e -o pipefail

ROOT=$(dirname "${BASH_SOURCE}")/..
cd "${ROOT}"

echo '=========================================================================================='
echo "= lstf licensed under: ="
echo "https://github.com/yuuki/lstf/"
echo
cat "${ROOT}"/LICENSE
echo
echo "= LICENSE $(cat ${ROOT}/LICENSE | md5sum | awk '{print $1}')"
echo '=========================================================================================='
echo

echo "= Go (the standard library) licensed under: ="
echo "https://golang.org/"
echo
curl -sS https://raw.githubusercontent.com/golang/go/release-branch.go1.9/LICENSE 2>/dev/null
echo
echo '=========================================================================================='
echo

find_names=(-iname 'licen[sc]e*')
for repo in $(dep status -json | jq -rM '.[].ProjectRoot'); do
echo
echo '=========================================================================================='
echo "= vendor/${repo} licensed under: ="
echo "https://${repo}/"
for lic in $(find vendor/${repo} -xdev -follow -maxdepth 1 -type f "${find_names[@]}"); do
echo
cat "${lic}"
echo
echo "= ${lic} $(cat ${lic} | md5sum | awk '{print $1}')"
done
echo '=========================================================================================='
echo
done
21 changes: 21 additions & 0 deletions _tools/release
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
set -e

if [[ $(git status -s) != "" ]]; then
echo 2>&1 "git is currently in a dirty state"
exit 1
fi

current_version=$(gobump show -r)

echo "current version: $current_version"
read -p "input next version: " next_version

echo "--> Bumping version $next_version"
gobump set "$next_version" -w
echo "--> Generating CHANGELOG"
ghch -w -N "v$next_version"

git commit -am "Bump version $next_version"
git tag "v$next_version"
git push && git push --tags
14 changes: 14 additions & 0 deletions _tools/test_in_container
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

set -e -o pipefail

DOCKER_IMAGE_NAME="transtracer-test"
DOCKER_CONTAINER_NAME="transtracer-test-container"

if [[ $(docker ps -a | grep $DOCKER_CONTAINER_NAME) != "" ]]; then
docker rm -f $DOCKER_CONTAINER_NAME 2>/dev/null
fi

docker build -t $DOCKER_IMAGE_NAME .

docker run --volume "$GOPATH"/src/:/go/src/ -e GOOS=$GOOS -e GOARCH=$GOARCH --name $DOCKER_CONTAINER_NAME $DOCKER_IMAGE_NAME "$@"
6 changes: 6 additions & 0 deletions _tools/upload_artifacts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e

ver=v$(gobump show -r)
make crossbuild
ghr -username yuuki -replace ${ver} dist/${ver}

0 comments on commit 8f856fb

Please sign in to comment.