diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fa06a4d25020ab73a04bc3f90fdef4796ddfbfab..beec9aeca378f4b529145b9cb20d2a36897c08a8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,10 @@ image: "rust:latest" stages: - build + - upload + - release +# build gcli binary build: stage: build # image used for this build @@ -25,4 +28,27 @@ build: - target/release # only build gcli when adding a tag only: - - tags \ No newline at end of file + - tags + +# upload gcli binary to gitlab +upload: + stage: upload + image: curlimages/curl:latest + rules: + - if: $CI_COMMIT_TAG + script: + - | + curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file target/release/gcli "${PACKAGE_REGISTRY_URL}/gcli" + +# create a gitlab release pointing to this binary +release: + stage: release + image: registry.gitlab.com/gitlab-org/release-cli:latest + release: + tag_name: $CI_COMMIT_TAG + name: 'Release $CI_COMMIT_TAG' + description: 'Automated release for $CI_COMMIT_TAG' + assets: + - name: 'gcli' + link_type: binary + url: "${PACKAGE_REGISTRY_URL}/gcli" \ No newline at end of file