-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.gitlab-ci.yml
72 lines (69 loc) · 3 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
64
65
66
67
68
69
70
71
72
stages:
- build
- upload
- release
build-plugin:
stage: build
rules:
- if: $CI_COMMIT_TAG
tags:
- docker
- real-dind
image: docker:cli
before_script:
- apk add --no-cache go make
script:
- make download-tools
- make build
artifacts:
when: on_success
expire_in: 1 day
paths:
- build
push-plugin:
stage: upload
rules:
- if: $CI_COMMIT_TAG
needs:
- job: build-plugin
artifacts: true
image: curlimages/curl
script:
# prepare go version variable for release
# see https://docs.gitlab.com/ee/user/project/releases/release_cicd_examples.html#create-release-metadata-in-a-custom-script
- 'export GO_VERS=$(cat build/gotify-server-go-version)'
- 'echo "GO_VERS=$GO_VERS" > variables.env'
# check if upload already exists
- 'if curl --head --output /dev/null --fail "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/gotify-webhooks/${CI_COMMIT_TAG}_go${GO_VERS}/gotify-webhooks-linux-amd64.so"; then echo "Package already exists!"; false; else true; fi'
# upload
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build/gotify-webhooks-linux-amd64.so "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/gotify-webhooks/${CI_COMMIT_TAG}_go${GO_VERS}/gotify-webhooks-linux-amd64.so"'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build/gotify-webhooks-linux-arm-7.so "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/gotify-webhooks/${CI_COMMIT_TAG}_go${GO_VERS}/gotify-webhooks-linux-arm-7.so"'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file build/gotify-webhooks-linux-arm64.so "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/gotify-webhooks/${CI_COMMIT_TAG}_go${GO_VERS}/gotify-webhooks-linux-arm64.so"'
artifacts:
reports:
dotenv: variables.env
release-plugin:
stage: release
rules:
- if: $CI_COMMIT_TAG
needs:
- job: push-plugin
artifacts: true
image: registry.gitlab.com/gitlab-org/release-cli:latest
script:
- 'echo "Releasing ${CI_COMMIT_TAG}_go${GO_VERS}"'
release:
name: "Release ${CI_COMMIT_TAG}_go${GO_VERS}"
description: "Release of the Gotify Webhooks Plugin in version ${CI_COMMIT_TAG}_go${GO_VERS}. Compatible with all versions of Gotify built with Go ${GO_VERS}!"
tag_name: "$CI_COMMIT_TAG"
assets:
links:
- name: gotify-webhooks-linux-amd64.so
url: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/gotify-webhooks/${CI_COMMIT_TAG}_go${GO_VERS}/gotify-webhooks-linux-amd64.so"
link_type: package
- name: gotify-webhooks-linux-arm-7.so
url: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/gotify-webhooks/${CI_COMMIT_TAG}_go${GO_VERS}/gotify-webhooks-linux-arm-7.so"
link_type: package
- name: gotify-webhooks-linux-arm64.so
url: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/gotify-webhooks/${CI_COMMIT_TAG}_go${GO_VERS}/gotify-webhooks-linux-arm64.so"
link_type: package