Use .exe when building for Windows (#1251)

## Description

Use .exe when building for Windows. Adds quoting for paths.

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Test
- [x] 💻 CI/Deployment
- [x] 🐹 Trivial/Minor

## Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* #<issue>

## Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
This commit is contained in:
Abin Simon 2022-10-21 00:15:37 +05:30 committed by GitHub
parent 7919d5a321
commit f0e28ea4c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -58,24 +58,27 @@ if [ "$MODE" == "binary" ]; then
printf "Building for %s...\r" "$platform"
docker run --rm \
--mount type=bind,src=${ROOT},dst="/app" \
--mount type=bind,src=${CORSO_BUILD_CACHE},dst=${CORSO_BUILD_CACHE} \
--env GOMODCACHE=${CORSO_BUILD_CACHE}/mod --env GOCACHE=${CORSO_BUILD_CACHE}/cache \
--mount type=bind,src="${ROOT}",dst="/app" \
--mount type=bind,src="${CORSO_BUILD_CACHE}",dst="${CORSO_BUILD_CACHE}" \
--env GOMODCACHE="${CORSO_BUILD_CACHE}/mod" --env GOCACHE="${CORSO_BUILD_CACHE}/cache" \
--env GOOS=${GOOS} --env GOARCH=${GOARCH} \
--workdir "/app/src" \
golang:${GOVER} \
go build -o corso -ldflags "${CORSO_BUILD_LDFLAGS}"
mkdir -p ${ROOT}/bin/${GOOS}-${GOARCH}
mv ${ROOT}/src/corso ${ROOT}/bin/${GOOS}-${GOARCH}/corso
echo Corso $platform binary available in ${ROOT}/bin/${GOOS}-${GOARCH}/corso
OUTFILE="corso"
[ "$GOOS" == "windows" ] && OUTFILE="corso.exe"
mkdir -p "${ROOT}/bin/${GOOS}-${GOARCH}"
mv "${ROOT}/src/corso" "${ROOT}/bin/${GOOS}-${GOARCH}/${OUTFILE}"
echo Corso $platform binary available in "${ROOT}/bin/${GOOS}-${GOARCH}/${OUTFILE}"
done
else
echo Building "$TAG" image for "$PLATFORMS"
docker buildx build --tag ${TAG} \
--platform ${PLATFORMS} \
--file ${ROOT}/build/Dockerfile \
--file "${ROOT}/build/Dockerfile" \
--build-arg CORSO_BUILD_LDFLAGS="$CORSO_BUILD_LDFLAGS" \
--load ${ROOT}
--load "${ROOT}"
echo Built container image "$TAG"
fi