-
Notifications
You must be signed in to change notification settings - Fork 3
/
codefresh.yaml
65 lines (58 loc) · 1.69 KB
/
codefresh.yaml
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
65
version: '1.0'
stages:
- Prepare
- Test
- Release
steps:
main_clone:
stage: Prepare
title: clone repository
type: git-clone
git: cf_github
repo: ${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}
revision: ${{CF_BRANCH}}
prepare_env_vars: &deps
stage: Prepare
title: prepare-env
image: quay.io/codefresh/golang-ci-helper:1.22
commands:
- cf_export GO111MODULE=on
- cf_export GOCACHE=/codefresh/volume/gocache # change gopath to codefresh shared volume
- cf_export GOPATH=/codefresh/volume/gopath
- cf_export GOSUMDB=off
- cf_export PATH=$PATH:/codefresh/volume/gopath/bin
- cf_export LATEST_VERSION=$(curl --silent -H "Authorization:Bearer ${{GITHUB_TOKEN}}" "https://api.github.com/repos/${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}/releases/latest" | jq -r ".tag_name")
- cf_export VERSION=$(make cur-version)
compare_versions:
stage: Prepare
title: compare versions
image: alpine/semver
commands:
- semver "${{VERSION}}" -r ">${{LATEST_VERSION}}" || (echo "bump version! current is ${{VERSION}} latest is ${{LATEST_VERSION}}" && exit 1)
when:
branch:
ignore:
- master
lint:
<<: *deps
stage: Test
title: lint
commands:
- make lint
test:
<<: *deps
stage: Test
title: unit-tests
commands:
- make test-all
ReleasingBinaries:
<<: *deps
stage: Release
title: Create release in Github
commands:
- VERSION=$(if [[ ${VERSION:0:1} == "v" ]] ; then echo $VERSION; else echo "v${VERSION}"; fi )
- gh release create --repo ${{CF_REPO_OWNER}}/${{CF_REPO_NAME}} -t $VERSION -n $VERSION $VERSION
when:
branch:
only:
- master