forked from pedropombeiro/qnapexporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
55 lines (49 loc) · 1.45 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
stages:
- build
- upload
- release
default:
image: golang:1.19-buster
tags:
- gitlab-org
variables:
# Package version can only contain numbers (0-9), and dots (.).
# Must be in the format of X.Y.Z, i.e. should match /\A\d+\.\d+\.\d+\z/ regular expresion.
# See https://docs.gitlab.com/ee/user/packages/generic_packages/#publish-a-package-file
PACKAGE_VERSION: "1.0.4"
LINUX_AMD64_BINARY: "qnapexporter"
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/qnapexporter/${PACKAGE_VERSION}"
build:
stage: build
script:
- make build
artifacts:
paths:
- bin/
expire_in: 30 days
test:
stage: build
script:
- make test
upload:
stage: upload
image: curlimages/curl:latest
rules:
- if: $CI_COMMIT_TAG
script:
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file bin/qnapexporter ${PACKAGE_REGISTRY_URL}/${LINUX_AMD64_BINARY}
linux-release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs:
- job: build
artifacts: true
- job: test
artifacts: false
rules:
- if: $CI_COMMIT_TAG # Run this job when a tag is created manually
script:
- |
release-cli create --name "Release $CI_COMMIT_TAG" --description CHANGELOG.md --tag-name "$CI_COMMIT_TAG" --ref "$CI_COMMIT_SHA" \
--assets-link "{\"name\":\"${LINUX_AMD64_BINARY}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${LINUX_AMD64_BINARY}\"}"