Update .gitlab-ci.yml

This commit is contained in:
Kai Kriegel 2021-12-28 00:33:12 +00:00
parent 68213f30ed
commit 3f0c45b802

View File

@ -15,6 +15,7 @@ variables:
# CARGO_HOME: $CI_PROJECT_DIR/cargo # CARGO_HOME: $CI_PROJECT_DIR/cargo
APT_CACHE_DIR: $CI_PROJECT_DIR/apt APT_CACHE_DIR: $CI_PROJECT_DIR/apt
# install build dependencies # install build dependencies
before_script: before_script:
- apt-get update -y - apt-get update -y
@ -96,7 +97,7 @@ build:docker-releases:
- linux - linux
- docker - docker
build:binary-development: build:binary:
image: rust:latest image: rust:latest
before_script: before_script:
@ -117,8 +118,8 @@ build:binary-development:
artifacts: artifacts:
paths: paths:
- target/armv7-unknown-linux-gnueabihf/debug - target/armv7-unknown-linux-gnueabihf/release
- target/x86_64-unknown-linux-gnu/debug - target/x86_64-unknown-linux-gnu/release
# only: # only:
# - development # - development
@ -126,6 +127,34 @@ build:binary-development:
- linux - linux
- docker - docker
upload:
stage: upload
image: curlimages/curl:latest
variables:
- PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/diflouroborane/${CI_COMMIT_TAG}"
rules:
- if: $CI_COMMIT_TAG
script:
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file target/armv7-unknown-linux-gnueabihf/release/diflouroborane "${PACKAGE_REGISTRY_URL}/diflouroborane-linux-armv7-${CI_COMMIT_TAG}"
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file target/x86_64-unknown-linux-gnu/release/diflouroborane "${PACKAGE_REGISTRY_URL}/diflouroborane-linux-amd64-${CI_COMMIT_TAG}"
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
variables:
- PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/diflouroborane/${CI_COMMIT_TAG}"
rules:
- if: $CI_COMMIT_TAG
script:
- |
release-cli create --name "Release $CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \
--assets-link "{\"name\":\"diflouroborane-linux-armv7-${CI_COMMIT_TAG}\",\"url\":\"${PACKAGE_REGISTRY_URL}/diflouroborane-linux-armv7-${CI_COMMIT_TAG}\"}" \
--assets-link "{\"name\":\"diflouroborane-linux-amd64-${CI_COMMIT_TAG}\",\"url\":\"${PACKAGE_REGISTRY_URL}/diflouroborane-linux-amd64-${CI_COMMIT_TAG}\"}"
# cache dependencies and build environment to speed up setup # cache dependencies and build environment to speed up setup
cache: cache:
key: "$CI_COMMIT_REF_SLUG" key: "$CI_COMMIT_REF_SLUG"