diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4816672..226885c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,6 +14,7 @@ variables: GIT_SUBMODULE_STRATEGY: recursive # CARGO_HOME: $CI_PROJECT_DIR/cargo APT_CACHE_DIR: $CI_PROJECT_DIR/apt + # install build dependencies before_script: @@ -96,7 +97,7 @@ build:docker-releases: - linux - docker -build:binary-development: +build:binary: image: rust:latest before_script: @@ -117,8 +118,8 @@ build:binary-development: artifacts: paths: - - target/armv7-unknown-linux-gnueabihf/debug - - target/x86_64-unknown-linux-gnu/debug + - target/armv7-unknown-linux-gnueabihf/release + - target/x86_64-unknown-linux-gnu/release # only: # - development @@ -126,6 +127,34 @@ build:binary-development: - linux - 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: key: "$CI_COMMIT_REF_SLUG"