2022-01-05 18:58:27 +01:00
|
|
|
# this script is used by the continuous integration server to
|
|
|
|
# build and publish the docker image for a commit to master.
|
2022-01-07 07:11:11 +01:00
|
|
|
$ErrorActionPreference = "Stop"
|
2022-01-05 18:58:27 +01:00
|
|
|
|
|
|
|
$env:GOOS="windows"
|
|
|
|
$env:GOARCH="amd64"
|
|
|
|
$env:CGO_ENABLED="0"
|
|
|
|
|
|
|
|
if (-not (Test-Path env:VERSION)) {
|
|
|
|
$env:VERSION="1809"
|
|
|
|
}
|
|
|
|
|
|
|
|
if (-not (Test-Path env:REGISTRY)) {
|
|
|
|
$env:REGISTRY="docker"
|
|
|
|
}
|
|
|
|
|
|
|
|
echo $env:GOOS
|
|
|
|
echo $env:GOARCH
|
|
|
|
echo $env:VERSION
|
2022-01-07 07:11:11 +01:00
|
|
|
echo $env:REGISTRY
|
2022-01-05 18:58:27 +01:00
|
|
|
|
|
|
|
# build the binary
|
2022-01-12 18:02:57 +01:00
|
|
|
Write-Host "+ go build -o release/windows/amd64/drone-${env:REGISTRY}.exe ./cmd/drone-${env:REGISTRY}";
|
2022-01-07 20:01:45 +01:00
|
|
|
go build -o release/windows/amd64/drone-${env:REGISTRY}.exe ./cmd/drone-${env:REGISTRY}
|
2022-01-05 18:58:27 +01:00
|
|
|
|
|
|
|
# build and publish the docker image
|
2022-01-07 07:11:11 +01:00
|
|
|
docker login -u ${env:USERNAME} -p ${env:PASSWORD}
|
|
|
|
Write-Host "+ docker build -f docker/${env:REGISTRY}/Dockerfile.windows.amd64.${env:VERSION} -t plugins/${env:REGISTRY}:windows-${env:VERSION}-amd64 .";
|
|
|
|
docker build -f docker/${env:REGISTRY}/Dockerfile.windows.amd64.${env:VERSION} -t plugins/${env:REGISTRY}:windows-${env:VERSION}-amd64 .
|
|
|
|
Write-Host "+ docker push plugins/${env:REGISTRY}:windows-${env:VERSION}-amd64"
|
|
|
|
docker push plugins/${env:REGISTRY}:windows-${env:VERSION}-amd64
|
2022-01-05 18:58:27 +01:00
|
|
|
|
|
|
|
# remove images from local cache
|
2022-01-07 07:11:11 +01:00
|
|
|
Write-Host "+ docker rmi plugins/${env:REGISTRY}:windows-${env:VERSION}-amd64"
|
|
|
|
docker rmi plugins/${env:REGISTRY}:windows-${env:VERSION}-amd64
|