1
0
Fork 0
mirror of https://github.com/pnx/pinger.git synced 2026-06-16 03:24:54 +02:00

.gitlab-ci.yml: Upload artifacts as package on tags.

This commit is contained in:
Henrik Hautakoski 2023-03-13 21:50:30 +01:00
parent afd054ff67
commit 39d20366dc

View file

@ -7,13 +7,13 @@
# This specific template is located at: # This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Go.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Go.gitlab-ci.yml
image: golang:latest
stages: stages:
- test - test
- build - build
- release
format: format:
image: golang:latest
stage: test stage: test
script: script:
- go fmt $(go list ./... | grep -v /vendor/) - go fmt $(go list ./... | grep -v /vendor/)
@ -21,6 +21,7 @@ format:
- go test -race $(go list ./... | grep -v /vendor/) - go test -race $(go list ./... | grep -v /vendor/)
compile: compile:
image: golang:latest
stage: build stage: build
script: script:
- mkdir -p bin - mkdir -p bin
@ -32,3 +33,14 @@ compile:
paths: paths:
- bin - bin
expire_in: 1 week expire_in: 1 week
upload:
stage: release
image: curlimages/curl:latest
rules:
- if: $CI_COMMIT_TAG
script:
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file bin/pinger-32.exe "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/release/${CI_COMMIT_TAG}/pinger-32.exe"'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file bin/pinger-x64.exe "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/release/${CI_COMMIT_TAG}/pinger-x64.exe"'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file bin/pinger-linux-x86 "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/release/${CI_COMMIT_TAG}/pinger-linux-x86"'
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file bin/pinger-linux-x64 "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/release/${CI_COMMIT_TAG}/pinger-linux-x64"'