-
Notifications
You must be signed in to change notification settings - Fork 24
/
codefresh.yml
87 lines (83 loc) · 2.14 KB
/
codefresh.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
version: "1.0"
stages:
- clone
- test
- release
steps:
main_clone:
title: "Cloning main repository..."
stage: clone
type: git-clone
repo: "${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}"
revision: "${{CF_REVISION}}"
git: cf_github
go_fmt:
title: "Formatting"
stage: test
image: goreleaser/goreleaser:v1.17.0
commands:
- go fmt
go_test:
title: "Run tests"
stage: test
image: golang:1.18.10-alpine3.17
environment:
- TF_ACC="test"
- CGO_ENABLED=0
commands:
- go install github.com/warrensbox/[email protected]
- terraform-switcher --latest-stable ${TF_VERSION}
- sleep $((RANDOM % 45))
- go test -v ./...
retry:
maxAttempts: 3
delay: 5
exponentialFactor: 2
matrix:
# The following will resolve to their latest patch version
environment:
- TF_VERSION=1.3.0
- TF_VERSION=1.7.0
when:
condition:
all:
release: "'${{RELEASE}}' != 'true'"
prepare_env_vars:
title: "Preparing environment variables..."
stage: release
image: quay.io/codefresh/codefresh-shell:0.0.13
shell: bash
environment:
- GPG_FINGERPRINT=${{GPG_FINGERPRINT}}
- SIGNINGKEY=${{SIGNINGKEY}}
commands:
- source /scripts/get-gh-token.sh
- cf_export GITHUB_TOKEN=$GITHUB_TOKEN --mask
- cf_export GPG_FINGERPRINT
- cf_export SIGNINGKEY
- cf_export GPG_PRIVATE
when:
condition:
all:
release: "'${{RELEASE}}' == 'true'"
release_binaries:
title: Create release in Github
image: goreleaser/goreleaser:v1.17.0
stage: release
environment:
- GPG_FINGERPRINT=${{GPG_FINGERPRINT}}
- SIGNINGKEY=${{SIGNINGKEY}}
- GPG_PRIVATE=${{GPG_PRIVATE}}
commands:
- apk update
- apk fetch gnupg
- apk add gnupg
- echo ${GPG_PRIVATE} | base64 -d > /tmp/private.key
- gpg --import /tmp/private.key
- git config user.signingkey ${GPG_FINGERPRINT}
- git clean -fdx
- goreleaser release --rm-dist
when:
condition:
all:
release: "'${{RELEASE}}' == 'true'"