31 lines
1.6 KiB
YAML
31 lines
1.6 KiB
YAML
prepare_job:
|
|
stage: build # This stage must run before the release stage
|
|
rules:
|
|
- if: $CI_COMMIT_TAG
|
|
when: never # Do not run this job when a tag is created manually
|
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when commits are pushed or merged to the default branch
|
|
script:
|
|
- echo "EXTRA_DESCRIPTION=some message" >> variables.env # Generate the EXTRA_DESCRIPTION and TAG environment variables
|
|
- echo "TAG=v$(cat VERSION)" >> variables.env # and append to the variables.env file
|
|
artifacts:
|
|
reports:
|
|
dotenv: variables.env # Use artifacts:reports:dotenv to expose the variables to other jobs
|
|
|
|
release_job:
|
|
stage: deploy
|
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
|
needs:
|
|
- job: prepare_job
|
|
artifacts: true
|
|
rules:
|
|
- if: $CI_COMMIT_TAG
|
|
when: never # Do not run this job when a tag is created manually
|
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when commits are pushed or merged to the default branch
|
|
script:
|
|
- echo 'running release_job for $TAG'
|
|
release:
|
|
name: 'Release $TAG'
|
|
description: 'Created using the release-cli $EXTRA_DESCRIPTION' # $EXTRA_DESCRIPTION and the $TAG
|
|
tag_name: '$TAG' # variables must be defined elsewhere
|
|
ref: '$CI_COMMIT_SHA' # in the pipeline. For example, in the
|