asset on tag upload
This commit is contained in:
parent
9d8d5d68ab
commit
495703d2ca
@ -16,12 +16,18 @@
|
||||
# This specific template is located at:
|
||||
# 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
|
||||
- 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.
|
||||
stage: build
|
||||
@ -38,25 +44,35 @@ build-job: # This job runs in the build stage, which runs first.
|
||||
when: on_success
|
||||
expire_in: 30 days
|
||||
paths:
|
||||
- "spry.*.*"
|
||||
- "spry-*-*"
|
||||
|
||||
#unit-test-job: # This job runs in the test stage.
|
||||
# stage: test # It only starts when the job in the build stage completes successfully.
|
||||
# script:
|
||||
# - echo "Running unit tests... This will take about 60 seconds."
|
||||
# - sleep 60
|
||||
# - echo "Code coverage is 90%"
|
||||
upload:
|
||||
stage: upload
|
||||
image: curlimages/curl:latest
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG
|
||||
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.
|
||||
# stage: test # It can run at the same time as unit-test-job (in parallel).
|
||||
# script:
|
||||
# - echo "Linting code... This will take about 10 seconds."
|
||||
# - sleep 10
|
||||
# - echo "No lint issues found."
|
||||
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
|
||||
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."
|
||||
|
Loading…
Reference in New Issue
Block a user