-
Notifications
You must be signed in to change notification settings - Fork 21
/
docker-publish.ps1
59 lines (44 loc) · 1.39 KB
/
docker-publish.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
param (
[Parameter(Mandatory=$True)]
[string] $version
)
$ErrorActionPreference = "Stop"
$versionParts = $version.Split('.')
$major = $versionParts[0]
$minor = $versionParts[1]
$isPre = $version.endswith("pre")
$image = "datalust/seqcli"
$archs = @("x64", "arm64")
$publishImages = @()
foreach ($arch in $archs) {
$ciImage = "$image-ci:$version-$arch"
$publishImage = "$($image):$version-$arch";
docker pull $ciImage
if ($LASTEXITCODE) { exit 1 }
docker tag $ciImage $publishImage
if ($LASTEXITCODE) { exit 1 }
docker push $publishImage
if ($LASTEXITCODE) { exit 1 }
$publishImages += $publishImage
}
$publishManifest = "$($image):$version"
$pushTags = @($publishManifest)
if ($isPre -eq $True) {
$pushTags += "$($image):preview"
} else {
$pushTags += "$($image):$major", "$($image):$major.$minor", "$($image):latest"
}
$choices = "&Yes", "&No"
$decision = $Host.UI.PromptForChoice("Publishing ($publishManifest) as ($pushTags)", "Does this look right?", $choices, 1)
if ($decision -eq 0) {
foreach ($pushTag in $pushTags) {
Write-Host "Publishing $pushTag"
echo "creating manifest $pushTag from $publishImages"
iex "docker manifest create $pushTag $publishImages"
if ($LASTEXITCODE) { exit 1 }
docker manifest push $pushTag
if ($LASTEXITCODE) { exit 1 }
}
} else {
Write-Host "Cancelled"
}