Skip to main content
Pipeline Status Coverage PyPI Project License PyPI Project Version

GitLab Auto Release

This is a simple Python cli script that allows you create releases in GitLab automatically. It is intended to be used during your CI/CD. However you can chose to use it however you wish.

Usage

First you need to create a personal access token, more information here. With the scope api, so it can create the release for you. This access token is passed to the script with the --private-token argument.

pip install gitlab-auto-release
gitlab_auto_release --help

Usage: gitlab_auto_release [OPTIONS]

  Gitlab Auto Release Tool.

Options:
  --private-token TEXT    Private GITLAB token, used to authenticate when
                          calling the Release API.  [required]
  --gitlab-url TEXT       The gitlab URL i.e. gitlab.com.
                          [required]
  --project-id INTEGER    The project ID on GitLab to create the Release for.
                          [required]
  --tag-name TEXT         The tag the release should be created from.
                          [required]
  --release-name TEXT     The name of the release.  [required]
  -c, --changelog TEXT    Path to file to changelog file, will append itself to the
                          description with tag matching changelog. Must be in
                          keepachangelog format.
  -d, --description TEXT  Path to file to use as the description for the Release.
  -a, --asset TEXT        An asset to include in the release, i.e.
                          name=link_to_asset.
  --artifacts TEXT        Will include artifacts from jobs specified in
                          current pipeline. Use job name.
  --help                  Show this message and exit.
gitlab_auto_release --private-token $(private_otken) --project-id 8593636 \
  --gitlab-url https://gitlab.com/stegappasaurus/stegappasaurus-app \
  --tag-name v0.1.0 --release-name v0.1.0 --changelog CHANGELOG.md

GitLab CI

Set a secret variable in your GitLab project with your private token. Name it GITLAB_PRIVATE_TOKEN (CI/CD > Environment Variables). This is necessary to create the release on your behalf. An example CI using this can be found here, look for the post:create:gitlab:release: job.

Add the following to your .gitlab-ci.yml file:

stages:
  - post

publish:release:
  image: registry.gitlab.com/gitlab-automation-toolkit/gitlab-auto-release
  stage: post
  before_script: []
  script:
    - gitlab_auto_release --changelog CHANGELOG.md --artifacts lint --artifacts report
Predefined Variables

Please note some of the arguments can be filled in using environment variables defined during GitLab CI. For more information click here <https://docs.gitlab.com/ee/ci/variables/predefined_variables.html>_.

  • If --private-token is not set the script will look for the ENV variable GITLAB_PRIVATE_TOKEN

  • If --gitlab-url is not set it will look for for the ENV variable CI_SERVER_URL

  • If --project-id is not set it will look for for the ENV variable CI_PROJECT_ID

  • If --tag-name is not set it will look for for the ENV variable CI_COMMIT_TAG

Setup Development Environment

git clone git@gitlab.com:gitlab-automation-toolkit/gitlab-auto-release.git
cd gitlab-auto-release
pip install tox
make install-venv
source .venv/bin/activate
make install-dev

Changelog

You can find the changelog here.

Metadata

Release files for gitlab-auto-release 4.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gitlab-auto-release 4.0.4
File Size Uploaded
gitlab-auto-release-4.0.4.tar.gz 6.0 kB Details

Release files / gitlab-auto-release-4.0.4.tar.gz

Download URL gitlab-auto-release-4.0.4.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8b79b49411a66e501fc274ffc0750d77152945510e113ceff0e506dc49db5d89
BLAKE2b-256 checksum
How to use checksums
030eac477b585a21357ae336af2ca747cb8e5de383307e0e268e0fecc4d9c1be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.12

Release history Release notifications | RSS feed

This release

4.0.4 This release

1 release file

4.0.3

1 release file

4.0.2

1 release file

4.0.1

1 release file

3.0.0

1 release file

2.0.5

1 release file

2.0.4

1 release file

2.0.3

1 release file

2.0.2

1 release file

2.0.1

1 release file

2.0.0

1 release file

1.1.0

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page