forked from Egbert-Azure/ssh-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
46 lines (42 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
stages:
- build
- upload
- release
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_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/SSHEngine"
build:
stage: build
image: golang:latest
rules:
- if: $CI_COMMIT_TAG
script:
- mkdir bin
- go get ssh-engine
- env GOOS=windows GOARCH=386 go build -o bin/SSHEngine-${CI_COMMIT_TAG}.exe SshEngine.go
artifacts:
paths:
- bin/
upload:
stage: upload
image: curlimages/curl:latest
needs: ["build"]
rules:
- if: $CI_COMMIT_TAG
script:
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file bin/SSHEngine-${CI_COMMIT_TAG}.exe ${PACKAGE_REGISTRY_URL}/${CI_COMMIT_TAG}/SSHEngine-${CI_COMMIT_TAG}.exe
release:
# Caution, as of 2021-02-02 these assets links require a login, see:
# https://gitlab.com/gitlab-org/gitlab/-/issues/299384
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs: ["upload"]
rules:
- if: $CI_COMMIT_TAG
script:
- |
release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \
--assets-link "{\"name\":\"SSHEngine-${CI_COMMIT_TAG}.exe\",\"url\":\"${PACKAGE_REGISTRY_URL}/${CI_COMMIT_TAG}/SSHEngine-${CI_COMMIT_TAG}.exe\"}"