-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
52 lines (41 loc) · 1.17 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
image: golang:latest
stages:
- build
- release
build:
stage: build
rules:
- if: $CI_COMMIT_TAG
script:
- echo "* Building executables"
- mkdir -p binaries
- GOOS=linux go build -o binaries/invent ./...
- GOOS=windows go build -o binaries/invent.exe ./...
- echo "ARTIFACT1_URL=${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/file/binaries/invent" >> variables.env
- echo "ARTIFACT2_URL=${CI_PROJECT_URL}/-/jobs/${CI_JOB_ID}/artifacts/file/binaries/invent.exe" >> variables.env
artifacts:
paths:
- binaries/invent
- binaries/invent.exe
reports:
dotenv: variables.env
expire_in: never
release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG
script:
- echo "* Creating release"
release:
name: "Release $CI_COMMIT_TAG"
description: "### Invent version $CI_COMMIT_TAG"
tag_name: $CI_COMMIT_TAG
assets:
links:
- name: "Executable (Linux)"
url: ${ARTIFACT1_URL}
filepath: "/assets/invent"
- name: "Executable (Windows)"
url: ${ARTIFACT2_URL}
filepath: "/assets/invent.exe"