-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy path.gitlab-ci.yml
57 lines (53 loc) · 1.72 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
54
55
56
57
variables:
IMAGE_NAME: terraform-provider-upcloud-releaser
VOLUME_NAME: terraform-provider-upcloud-releaser
before_script:
- docker build -t $IMAGE_NAME release/
after_script:
- docker rmi $IMAGE_NAME
test:
stage: test
script:
- docker volume inspect $VOLUME_NAME && docker volume rm $VOLUME_NAME
- docker volume create $VOLUME_NAME
- >-
docker run --rm -v $(pwd):/host:ro --entrypoint= --mount source=$VOLUME_NAME,destination=/go/src
$IMAGE_NAME cp -pR /host/. /go/src
- docker run --rm --mount source=$VOLUME_NAME,destination=/go/src --entrypoint= $IMAGE_NAME make test vet
- docker run --rm --mount source=$VOLUME_NAME,destination=/go/src --entrypoint= $IMAGE_NAME goreleaser check
after_script:
- docker volume rm $VOLUME_NAME
deploy_release:
variables:
GITHUB_TOKEN: ""
VAULT_ADDR: ""
VAULT_LOGIN: ""
VAULT_LOGIN_PASSWORD: ""
VAULT_SIGNER_PATH: ""
stage: deploy
only:
- tags
artifacts:
paths:
- dist
expire_in: 1 week
script:
- docker volume inspect $VOLUME_NAME && docker volume rm $VOLUME_NAME
- docker volume create $VOLUME_NAME
- >-
docker run --rm -v $(pwd):/host:ro --entrypoint= --mount source=$VOLUME_NAME,destination=/go/src
$IMAGE_NAME cp -pR /host/. /go/src
- >-
docker run --rm --mount source=$VOLUME_NAME,destination=/go/src
-e GITHUB_TOKEN
-e VAULT_ADDR
-e VAULT_LOGIN
-e VAULT_LOGIN_PASSWORD
-e VAULT_SIGNER_PATH
$IMAGE_NAME goreleaser release --rm-dist
- mkdir -p dist
- >-
docker run --rm --entrypoint= --mount source=$VOLUME_NAME,destination=/go/src
$IMAGE_NAME tar -C dist -c . | tar -C dist -x
after_script:
- docker volume rm $VOLUME_NAME