-
Notifications
You must be signed in to change notification settings - Fork 0
/
scripts.yml
49 lines (42 loc) · 1.26 KB
/
scripts.yml
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
# scripts.yml
shell: powershell
variables:
APP_NAME: liege
MAIN_FILE: ./cmd/liege.go
VERSION_FILE: ./internal/console/console.go
BIN_PATH: ./bin
BIN_FILE: ./bin/liege
DIST_PATH: ./dist
GOARCH: amd64
build:
params:
- GOOS
script:
- $ext = ""; if ($env:GOOS -eq "windows") { $ext = ".exe" }
- go build -ldflags="-s -w" -o "$env:BIN_FILE$ext" $env:MAIN_FILE
test:
script: go test ./... -v
release:
step_by_step: true
script:
- $v = (Get-Version $env:VERSION_FILE).Split(".")
- $v[1] = "$([int]$v[1] + 1)"; $version = "$($v -join ".")"
- Set-Version -Path $env:VERSION_FILE -Version "$version"
- echo "Update changelog..."
- git add CHANGELOG.md $env:VERSION_FILE
- git commit -m "Release $version"
- git tag -a "$version" -m "$version"
docker:build:
script:
- &version $version = (Get-Version $env:VERSION_FILE)
- docker build --pull -t gaelgirodon/liege .
- docker tag gaelgirodon/liege gaelgirodon/liege:$version
docker:push:
script:
- *version
- docker push gaelgirodon/liege:$version
- docker push gaelgirodon/liege:latest
clean:
script:
- if (Test-Path $env:BIN_PATH) { Remove-Item -Recurse $env:BIN_PATH }
- if (Test-Path $env:DIST_PATH) { Remove-Item -Recurse $env:DIST_PATH }