-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
63 lines (61 loc) · 1.68 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
stages:
- test
- build
- release
.go_template_defaults:
stage: test
.semver_template_defaults:
stage: release
variables:
SEMVER_PREFIX: v
include:
- { project: bonsai-oss/organization/automate/ci-templates, file: templates/language/go.yml, ref: 1.0.10 }
- { project: bonsai-oss/organization/automate/ci-templates, file: templates/release/semver.yml, ref: 1.0.10 }
build:
image: golang:latest
stage: build
parallel:
matrix:
- GOOS: [linux, darwin]
GOARCH: [amd64, arm64]
variables:
CGO_ENABLED: 0
script:
- mkdir -p build
- go build -ldflags '-s -w' -trimpath -o build/testfmt-$GOOS-$GOARCH
artifacts:
paths:
- build/
expire_in: 2 hours
release:
stage: release
needs:
- job: build
artifacts: true
image: registry.gitlab.com/gitlab-org/release-cli:latest
script:
- ls -la build/
rules:
- if: $CI_COMMIT_TAG
artifacts:
paths:
- build/
release:
name: Release $CI_COMMIT_TAG
tag_name: $CI_COMMIT_TAG
description: $CI_COMMIT_TAG
ref: $CI_COMMIT_TAG
assets:
links:
- name: testfmt-linux-amd64
url: $CI_PROJECT_URL/-/jobs/$CI_JOB_ID/artifacts/raw/build/testfmt-linux-amd64
link_type: package
- name: testfmt-linux-arm64
url: $CI_PROJECT_URL/-/jobs/$CI_JOB_ID/artifacts/raw/build/testfmt-linux-arm64
link_type: package
- name: testfmt-darwin-amd64
url: $CI_PROJECT_URL/-/jobs/$CI_JOB_ID/artifacts/raw/build/testfmt-darwin-amd64
link_type: package
- name: testfmt-darwin-arm64
url: $CI_PROJECT_URL/-/jobs/$CI_JOB_ID/artifacts/raw/build/testfmt-darwin-arm64
link_type: package