-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
53 lines (47 loc) · 1.32 KB
/
.gitlab-ci.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
50
51
52
53
image: docker:19.03.12
services:
- docker:19.03.12-dind
variables:
CI_APPLICATION_TAG: $CI_COMMIT_TAG
DOCKER_TLS_CERTDIR: "/certs"
WINDOWS_BINARY: "tiddly-saver.exe"
WINDOWS_ZIP: "tiddly-saver-windows.zip"
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/tiddly-saver/${CI_COMMIT_TAG}"
stages:
- build
- test
- upload
- release
build-tags-windows-amd64:
stage: build
variables:
GOOS: windows
GOARCH: amd64
only:
- tags
script:
- docker build -t $CI_REGISTRY_IMAGE:build -f Dockerfile.windows .
- id=$(docker create $CI_REGISTRY_IMAGE:build)
- docker cp $id:/srv/${WINDOWS_BINARY} ./${WINDOWS_BINARY}
- apk add zip
- zip -r ${WINDOWS_ZIP} assets/ config.yml.example ${WINDOWS_BINARY}
artifacts:
paths:
- ./${WINDOWS_ZIP}
upload-tags-windows-amd64:
stage: upload
image: curlimages/curl:latest
only:
- tags
script:
- |
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ./${WINDOWS_ZIP} ${PACKAGE_REGISTRY_URL}/${WINDOWS_ZIP}
release-tags:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
only:
- tags
script:
- |
release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \
--assets-link "{\"name\":\"${WINDOWS_ZIP}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${WINDOWS_ZIP}\"}"