Release generation from within `.gitlab-ci.yml`
Problem to solve
Now that we have a releases page (https://gitlab.com/gitlab-org/gitlab-ce/issues/41766), there should be a straightforward way to create a release from the .gitlab-ci.yml
without making curls to the Releases API.
Target audience
Automation engineers who are working on releases and want a native way to add releases without using script:
elements to curl an API
Further details
This is good polish for the releases feature in that it makes the integration feel better integrated into the product. Also, this provides better overall experience once features like https://gitlab.com/gitlab-org/gitlab-ce/issues/56023 are implemented.
Proposal
Introduce a new job syntax that can create a release automatically using POST /projects/:id/releases
behind the scenes:
stages:
- build
- test
- release
build-osx:
stage: build
# ...
artifacts:
# ...
build-linux:
stage: build
# ...
artifacts:
# ...
release:
stage: release
only: tags
script:
- make changelog | tee release_changelog.txt
release:
name: My $CI_PROJECT_NAME Release 1.0-$CI_COMMIT_SHORT_SHA
description: ./release_changelog.txt
assets:
- name: cool-app.zip
url: http://my.awesome.download.site/1.0-$CI_COMMIT_SHORT_SHA.zip
- name: cool-app.dmg
path: out/cool-app.dmg
- name: document-${APP_VERSION}.pdf
path: out/doc/document.pdf
-
release
indicates that the job produces release asset(s). It is active only if git reference is tag -
release:name
specifies the release name. If it's not created yet, then create a new entry. -
release:description
specifies a file containing the description of the release (can point to changelog) -
release:assets
adds assets to the release. -
release:assets:name
specified the asset name. If the same name of an asset already existed, then overwriteurl
orpath
. -
release:assets:url
specified the link of an asset (Implying asset type is Link). -
release:assets:path
specified the binary path of an artifact (Implying asset type is Package). GitLab automatically transfer the result from the artifact to package.
Edited by Jason Yavorska