-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathpublish.ps1
More file actions
55 lines (47 loc) · 1.27 KB
/
publish.ps1
File metadata and controls
55 lines (47 loc) · 1.27 KB
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
<#
.SYNOPSIS
Rebuild the application, build Docker image and publish it to the Docker Hub.
.PARAMETER Version
A version used for publishing of a Docker image.
.PARAMETER DockerId
Docker Hub username.
.PARAMETER SourceRoot
The root directory of the source code.
.PARAMETER sbt
A path to the sbt executable.
.PARAMETER docker
A path to the Docker executable.
#>
param (
[Parameter(Mandatory=$true)]
[string] $Version,
[string] $DockerId = 'revenrof',
[string] $SourceRoot = "$PSScriptRoot/../../",
[string] $sbt = 'sbt',
[string] $docker = 'docker'
)
$ErrorActionPreference = 'Stop'
function inPath($path, $action) {
try {
Set-Location $path
& $action
} finally {
Pop-Location
}
}
function exec($command) {
Write-Host "[exec] $command $args" -ForegroundColor White
& $command $args
if (!$?) {
throw "[error] $command $args = $LASTEXITCODE"
}
}
inPath $SourceRoot {
exec $sbt clean assembly
}
Copy-Item -Force $PSScriptRoot/../../target/scala-2.11/horta-hell-assembly.jar $PSScriptRoot/horta-hell.jar
exec $docker build -t=codingteam/horta-hell $PSScriptRoot
$tag = "$DockerId/horta-hell:$Version"
exec $docker login
exec $docker tag codingteam/horta-hell $tag
exec $docker push $tag