From 44901a5e3e4818e9caeb7fc4438e8ce5a6081516 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 28 Dec 2022 19:45:41 -0600 Subject: [PATCH] Automatically release when tag is pushed to CI --- .gitlab-ci.yml | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index cdf22dd2e..61bf382db 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,6 +15,7 @@ stages: - deps - test - deploy + - release deps: stage: deps @@ -168,4 +169,34 @@ docker: only: refs: - develop - interruptible: true \ No newline at end of file + interruptible: true + +# https://docs.gitlab.com/ee/user/project/releases/release_cicd_examples.html#create-release-metadata-in-a-custom-script +prepare-release: + stage: release + rules: + - if: $CI_COMMIT_TAG + script: + - echo "EXTRA_DESCRIPTION=$(npx ts-node ./scripts/changelog.ts $CI_COMMIT_TAG)" >> variables.env + artifacts: + reports: + dotenv: variables.env + +release: + stage: release + image: registry.gitlab.com/gitlab-org/release-cli:latest + needs: + - job: prepare-release + artifacts: true + rules: + - if: $CI_COMMIT_TAG + script: + - echo "running release" + release: + tag_name: '$CI_COMMIT_TAG' + description: '$EXTRA_DESCRIPTION' + assets: + links: + - name: Build + url: 'https://gitlab.com/soapbox-pub/soapbox/-/jobs/artifacts/$CI_COMMIT_TAG/download?job=build-production' + link_type: package \ No newline at end of file