-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
64 lines (60 loc) · 1.58 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
58
59
60
61
62
63
64
stages:
- Build CLI
- Build Container
- Publish
variables:
GIT_SUBMODULE_STRATEGY: recursive
Go Build:
stage: Build CLI
image: golang:1.17.2
tags:
- k8s:shared
- arch:amd64
script:
- (cd ./cli && go get ./... && go build github.com/deepsourcelabs/cli)
- export UPSTREAM_TAG=$(cd ./cli && git describe)
- echo $UPSTREAM_TAG > .upstream_tag
cache:
key: ${CI_COMMIT_SHA}
paths:
- .upstream_tag
policy: push
Kaniko:
stage: Build Container
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [ "" ]
tags:
- k8s:shared
- arch:amd64
script:
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --no-push
Publish GitHub - REST API:
environment: GitHub
stage: Publish
only:
refs:
- main
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [ "" ]
tags:
- k8s:shared
- arch:amd64
before_script:
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"ghcr.io\":{\"username\":\"elliotcourant\",\"password\":\"$K8S_SECRET_GITHUB_ACCESS_TOKEN\"}}}" > /kaniko/.docker/config.json
script:
- export UPSTREAM_TAG=$(cat .upstream_tag)
- echo "Publishing as $UPSTREAM_TAG"
- |
/kaniko/executor --context $CI_PROJECT_DIR \
--build-arg $CI_COMMIT_SHA \
--dockerfile $CI_PROJECT_DIR/Dockerfile \
--destination ghcr.io/harderthanitneedstobe/deepsource:latest \
--destination ghcr.io/harderthanitneedstobe/deepsource:$UPSTREAM_TAG
cache:
key: ${CI_COMMIT_SHA}
paths:
- .upstream_tag
policy: pull