mirror of
https://github.com/Luzifer/github-publish.git
synced 2024-12-20 18:01:22 +00:00
Leave build dir at the end for following tassk
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
a346ae949a
commit
68ba18f83d
2 changed files with 33 additions and 33 deletions
|
@ -1,2 +1,2 @@
|
|||
05e4977d541b2ef07c757acca912b7b58b379fb425eceb3a1f53c829a78a4aa4 docker2aci.sh
|
||||
b3fb1862829bd85992de6c234d3895483fb92a963a489376fde32182fa5a8c55 golang.sh
|
||||
635091c14de852b5cb183ebe345c2711f430907c439aec7c9d5dba1b9c8309cd golang.sh
|
||||
|
|
28
golang.sh
28
golang.sh
|
@ -1,21 +1,21 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
curl -sL https://raw.githubusercontent.com/Luzifer/github-publish/master/SHA256SUMS | \
|
||||
curl -sL https://raw.githubusercontent.com/Luzifer/github-publish/master/SHA256SUMS |
|
||||
grep "golang.sh" | sha256sum -c || exit 2
|
||||
|
||||
( which zip 2>&1 1>/dev/null ) || {
|
||||
( which apk 2>&1 1>/dev/null ) && apk add --update zip
|
||||
( which apt-get 2>&1 1>/dev/null ) && apt-get install -y zip
|
||||
(which zip 2>&1 1>/dev/null) || {
|
||||
(which apk 2>&1 1>/dev/null) && apk add --update zip
|
||||
(which apt-get 2>&1 1>/dev/null) && apt-get install -y zip
|
||||
}
|
||||
|
||||
function step {
|
||||
function step() {
|
||||
echo "===> $@..."
|
||||
}
|
||||
|
||||
VERSION=$(git describe --tags --exact-match || echo "ghpublish__notags")
|
||||
PWD=$(pwd)
|
||||
godir=${PWD/${GOPATH}\/src\/}
|
||||
godir=${PWD/${GOPATH}\/src\//}
|
||||
REPO=${REPO:-$(echo ${godir} | cut -d '/' -f 3)}
|
||||
GHUSER=${GHUSER:-$(echo ${godir} | cut -d '/' -f 2)}
|
||||
ARCHS=${ARCHS:-"linux/amd64 linux/arm darwin/amd64 windows/amd64"}
|
||||
|
@ -31,15 +31,18 @@ step Test code
|
|||
go vet ${PACKAGES}
|
||||
go test ${PACKAGES}
|
||||
|
||||
step Cleanup build directory if present
|
||||
rm -rf ${BUILD_DIR}
|
||||
|
||||
step Compile program
|
||||
mkdir ${BUILD_DIR}
|
||||
gox -ldflags="-X main.version=${VERSION}" -osarch="${ARCHS}" \
|
||||
-output="${BUILD_DIR}/{{.Dir}}_{{.OS}}_{{.Arch}}"\
|
||||
-output="${BUILD_DIR}/{{.Dir}}_{{.OS}}_{{.Arch}}" \
|
||||
${PACKAGES}
|
||||
|
||||
step Generate binary SHASUMs
|
||||
cd ${BUILD_DIR}
|
||||
sha256sum * > SHA256SUMS
|
||||
sha256sum * >SHA256SUMS
|
||||
|
||||
step Packing archives
|
||||
for file in *; do
|
||||
|
@ -57,13 +60,13 @@ for file in *; do
|
|||
done
|
||||
|
||||
step Generate archive SHASUMs
|
||||
sha256sum * >> SHA256SUMS
|
||||
grep -v 'SHA256SUMS' SHA256SUMS > SHA256SUMS.tmp
|
||||
sha256sum * >>SHA256SUMS
|
||||
grep -v 'SHA256SUMS' SHA256SUMS >SHA256SUMS.tmp
|
||||
mv SHA256SUMS.tmp SHA256SUMS
|
||||
|
||||
step Publish builds to Github
|
||||
|
||||
if ( test "${VERSION}" == "ghpublish__notags" ); then
|
||||
if (test "${VERSION}" == "ghpublish__notags"); then
|
||||
echo "No tag present, stopping build now."
|
||||
exit 0
|
||||
fi
|
||||
|
@ -85,7 +88,4 @@ done
|
|||
echo -e "\n\n=== Recorded checksums ==="
|
||||
cat SHA256SUMS
|
||||
|
||||
step Cleanup build directory
|
||||
cd -
|
||||
rm -rf ${BUILD_DIR}
|
||||
|
||||
|
|
Loading…
Reference in a new issue