-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
64 lines (60 loc) · 2.01 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
include:
- project: 'strmprivacy/tools-and-utilities/ci-templates'
file: '/common/semantic-release.yml'
- project: 'strmprivacy/tools-and-utilities/ci-templates'
file: '/rules/rules.yml'
- local: '.gitlab/go.yml'
- local: '.gitlab/jvm.yml'
- local: '.gitlab/lint-and-breaking.yml'
- local: '.gitlab/python.yml'
- local: '.gitlab/typescript.yml'
- local: '.gitlab/gripmock.yml'
stages:
- lint-and-breaking
- generate
- release
- publish
release:
stage: release
extends: .semantic-release
generate:
stage: generate
image:
name: bufbuild/buf:1.20.0
entrypoint: [""]
script:
- apk add --update make
- make generate
artifacts:
paths:
- "lang/**/src"
reports:
dotenv: VERSION.env
needs:
- job: buf-lint
optional: true
- job: aip-guidelines-lint
optional: true
- job: breaking
optional: true
except:
- master
bsr-push:
stage: publish
extends:
- .only-tags
image:
name: bufbuild/buf:1.20.0
entrypoint: [ "" ]
script:
- apk add --update make
- cd protos
- buf push --tag "${CI_COMMIT_TAG}"
# Due to this issue (https://github.com/bufbuild/buf/issues/1621) in buf, no tag is created if the proto files are not changed
# To keep the BSR tags in sync with our git repo, we manually add it
- apk update
- apk add curl jq
- 'latest_commit=$(curl "https://api.buf.build/buf.alpha.registry.v1alpha1.RepositoryCommitService/ListRepositoryCommitsByReference" -H "content-type: application/json" --data-raw "{\"repositoryOwner\":\"strmprivacy\",\"repositoryName\":\"apis\",\"reference\":\"main\",\"pageSize\":1,\"reverse\":true}" | jq -r ".repositoryCommits[0].name")'
- 'curl "https://api.buf.build/buf.alpha.registry.v1alpha1.RepositoryTagService/CreateRepositoryTag" -H "content-type: application/json" -u "strmprivacy:$BUF_TOKEN" --data-raw "{\"repositoryId\":\"4e0c9176-b1c3-42b4-8f81-f40f306128ab\",\"name\":\"${CI_COMMIT_TAG}\",\"commitName\":\"${latest_commit}\"}"'
needs:
- generate