asset on tag upload
This commit is contained in:
parent
9d8d5d68ab
commit
495703d2ca
@ -16,12 +16,18 @@
|
|||||||
# This specific template is located at:
|
# This specific template is located at:
|
||||||
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml
|
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml
|
||||||
|
|
||||||
variables:
|
|
||||||
GIT_SUBMODULE_STRATEGY: recursive
|
|
||||||
|
|
||||||
stages: # List of stages for jobs, and their order of execution
|
stages: # List of stages for jobs, and their order of execution
|
||||||
- build
|
- build
|
||||||
|
- upload
|
||||||
|
- release
|
||||||
|
|
||||||
|
variables:
|
||||||
|
GIT_SUBMODULE_STRATEGY: recursive
|
||||||
|
LINUX_AMD64_BINARY: "spry-linux-amd64"
|
||||||
|
LINUX_ARM64_BINARY: "spry-linux-arm64"
|
||||||
|
DARWIN_AMD64_BINARY: "spry-darwin-amd64"
|
||||||
|
DARWIN_ARM64_BINARY: "spry-darwin-arm64"
|
||||||
|
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/myawesomerelease/${CI_COMMIT_TAG}"
|
||||||
|
|
||||||
build-job: # This job runs in the build stage, which runs first.
|
build-job: # This job runs in the build stage, which runs first.
|
||||||
stage: build
|
stage: build
|
||||||
@ -38,25 +44,35 @@ build-job: # This job runs in the build stage, which runs first.
|
|||||||
when: on_success
|
when: on_success
|
||||||
expire_in: 30 days
|
expire_in: 30 days
|
||||||
paths:
|
paths:
|
||||||
- "spry.*.*"
|
- "spry-*-*"
|
||||||
|
|
||||||
#unit-test-job: # This job runs in the test stage.
|
upload:
|
||||||
# stage: test # It only starts when the job in the build stage completes successfully.
|
stage: upload
|
||||||
# script:
|
image: curlimages/curl:latest
|
||||||
# - echo "Running unit tests... This will take about 60 seconds."
|
rules:
|
||||||
# - sleep 60
|
- if: $CI_COMMIT_TAG
|
||||||
# - echo "Code coverage is 90%"
|
script:
|
||||||
|
- |
|
||||||
|
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file ${LINUX_AMD64_BINARY} ${PACKAGE_REGISTRY_URL}/${LINUX_AMD64_BINARY}
|
||||||
|
- |
|
||||||
|
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file ${LINUX_ARM64_BINARY} ${PACKAGE_REGISTRY_URL}/${LINUX_ARM64_BINARY}
|
||||||
|
- |
|
||||||
|
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file ${DARWIN_AMD64_BINARY} ${PACKAGE_REGISTRY_URL}/${DARWIN_AMD64_BINARY}
|
||||||
|
- |
|
||||||
|
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file ${DARWIN_ARM64_BINARY} ${PACKAGE_REGISTRY_URL}/${DARWIN_ARM64_BINARY}
|
||||||
|
|
||||||
#lint-test-job: # This job also runs in the test stage.
|
release:
|
||||||
# stage: test # It can run at the same time as unit-test-job (in parallel).
|
# Caution, as of 2021-02-02 these assets links require a login, see:
|
||||||
# script:
|
# https://gitlab.com/gitlab-org/gitlab/-/issues/299384
|
||||||
# - echo "Linting code... This will take about 10 seconds."
|
stage: release
|
||||||
# - sleep 10
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
||||||
# - echo "No lint issues found."
|
rules:
|
||||||
|
- if: $CI_COMMIT_TAG
|
||||||
|
script:
|
||||||
|
- |
|
||||||
|
release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \
|
||||||
|
--assets-link "{\"name\":\"${LINUX_AMD64_BINARY}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${LINUX_AMD64_BINARY}\"}" \
|
||||||
|
--assets-link "{\"name\":\"${LINUX_AMD64_BINARY}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${LINUX_ARM64_BINARY}\"}" \
|
||||||
|
--assets-link "{\"name\":\"${DARWIN_AMD64_BINARY}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${DARWIN_AMD64_BINARY}\"}" \
|
||||||
|
--assets-link "{\"name\":\"${DARWIN_AMD64_BINARY}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${DARWIN_ARM64_BINARY}\"}"
|
||||||
|
|
||||||
#deploy-job: # This job runs in the deploy stage.
|
|
||||||
# stage: deploy # It only runs when *both* jobs in the test stage complete successfully.
|
|
||||||
# environment: production
|
|
||||||
# script:
|
|
||||||
# - echo "Deploying application..."
|
|
||||||
# - echo "Application successfully deployed."
|
|
||||||
|
4
Makefile
4
Makefile
@ -7,11 +7,11 @@
|
|||||||
EXECUTABLE := spry
|
EXECUTABLE := spry
|
||||||
|
|
||||||
ifdef GOOS
|
ifdef GOOS
|
||||||
EXECUTABLE := $(EXECUTABLE).$(GOOS)
|
EXECUTABLE := $(EXECUTABLE)-$(GOOS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef GOARCH
|
ifdef GOARCH
|
||||||
EXECUTABLE := $(EXECUTABLE).$(GOARCH)
|
EXECUTABLE := $(EXECUTABLE)-$(GOARCH)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
VERSION ?= $(shell ./.version/calculate-version.sh)
|
VERSION ?= $(shell ./.version/calculate-version.sh)
|
||||||
|
Loading…
Reference in New Issue
Block a user