1
0
Fork 0
mirror of https://github.com/Luzifer/github-publish.git synced 2024-11-09 23:00:14 +00:00

Remove zip package installation, add case for "." package naming

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2022-06-28 00:05:26 +02:00
parent b880c3fa41
commit ff36e63eaa
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D
2 changed files with 13 additions and 8 deletions

View file

@ -1,2 +1,2 @@
05e4977d541b2ef07c757acca912b7b58b379fb425eceb3a1f53c829a78a4aa4 docker2aci.sh
54cf7735ce36c401e8bb728aaf75ec64d50c89e737fa33a6a017d087990c0d91 golang.sh
159cebe6207975d84c8013ebc154819ca59802dec42c7b44c65be5ec0e56e8d2 golang.sh

View file

@ -4,11 +4,6 @@ set -euo pipefail
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 gawk zip
(which apt-get 2>&1 1>/dev/null) && apt-get update && apt-get install -y zip
}
function log() {
echo "${@}" >&2
}
@ -21,6 +16,15 @@ function substep() {
log "======> $@..."
}
required_tools=(go sha256sum tar zip)
for tool in "${required_tools[@]}"; do
(command -v apk 2>&1 1>/dev/null) || {
log "Missing tool '${tool}'"
exit 1
}
done
VERSION=$(git describe --tags --always || echo "dev")
PWD=$(pwd)
godir=${PWD/${GOPATH}\/src\//}
@ -77,8 +81,9 @@ for package in "${PACKAGES[@]}"; do
export GOOS=${osarch%%/*}
export GOARCH=${osarch##*/}
[[ ${GOOS} == "windows" ]] && suffix=".exe" || suffix=""
outfile="${BUILD_DIR}/${package##*/}_${GOOS}_${GOARCH}${suffix}"
[[ $GOOS == "windows" ]] && suffix=".exe" || suffix=""
[[ $package == '.' ]] && bname="${PWD##*/}" || bname="${package##*/}"
outfile="${BUILD_DIR}/${bname}_${GOOS}_${GOARCH}${suffix}"
substep "Build for ${osarch} into ${outfile}"