Skip to content

Commit b64a86f

Browse files
authored
Merge pull request #10 from ecstatic-morse/azure-pipelines
Use Azure Pipelines for Windows instead of AppVeyor
2 parents fe1bd41 + a0bcddb commit b64a86f

File tree

4 files changed

+27
-36
lines changed

4 files changed

+27
-36
lines changed

appveyor.yml

-22
This file was deleted.

azure-pipelines.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
variables:
2+
- group: docker-creds
3+
4+
jobs:
5+
- job: Windows
6+
pool:
7+
vmImage: win1803
8+
variables:
9+
IMAGE_NAME: 'crates-build-env-windows'
10+
steps:
11+
- pwsh: ./windows/ci/build.ps1
12+
displayName: Build Docker image
13+
- pwsh: ./windows/ci/publish.ps1
14+
displayName: Publish image to Docker Hub
15+
condition: |
16+
and(succeeded(),
17+
eq(variables['Build.SourceBranch'], 'refs/heads/master'),
18+
ne(variables['Build.Reason'], 'PullRequest'))
19+
env:
20+
DOCKER_PASSWORD: $(DOCKER_PASSWORD)
21+
DOCKER_USERNAME: $(DOCKER_USERNAME)

windows/ci/build.ps1

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
$ErrorActionPreference = "Stop"
2-
3-
$ContainerBase = '@sha256:c06b4bfaf634215ea194e6005450740f3a230b27c510cf8facab1e9c678f3a99'
1+
$ContainerBase = ':1803'
42

53
docker build `
6-
-t "$env:PUSH_IMAGE" `
4+
-t "$env:IMAGE_NAME" `
75
--build-arg "BASE_IMAGE_VER=$ContainerBase" `
86
windows

windows/ci/publish.ps1

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1-
$ErrorActionPreference = "Stop"
2-
3-
# Build the image
4-
./windows/ci/build.ps1
5-
61
foreach ($var in "DOCKER_USERNAME", "DOCKER_PASSWORD") {
72
if (-not (Test-Path "env:$var")) {
83
echo "Environment variable \"$var\" not set"
94
exit 22
105
}
116
}
127

13-
# Log in to dockerhub
14-
[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($Env:DOCKER_PASSWORD)).Trim() `
15-
| docker login --username "$Env:DOCKER_USERNAME" --password-stdin
16-
17-
docker push "$env:PUSH_IMAGE"
8+
Write-Host "Publishing to hub.docker.com/$env:DOCKER_USERNAME"
9+
docker login --username "$env:DOCKER_USERNAME" --password "$env:DOCKER_PASSWORD"
10+
docker tag "$env:IMAGE_NAME" "$env:DOCKER_USERNAME/$env:IMAGE_NAME"
11+
docker push "$env:DOCKER_USERNAME/$env:IMAGE_NAME"

0 commit comments

Comments
 (0)