GitLab CI template for GitLab Package¶
This project implements a GitLab CI/CD template to publish artifacts to GitLab's Generic Package Registry.
Usage¶
This template can be used both as a CI/CD component
or using the legacy include:project syntax.
Use as a CI/CD component¶
Add the following to your .gitlab-ci.yml:
include:
# 1: include the component
- component: $CI_SERVER_FQDN/to-be-continuous/gitlab-package/gitlab-ci-gitlab-package@1.6.0
# 2: set/override component inputs
inputs:
files: "build/*.tgz" # ⚠ this is only an example
Use as a CI/CD template (legacy)¶
Add the following to your .gitlab-ci.yml:
include:
# 1: include the template
- project: 'to-be-continuous/gitlab-package'
ref: '1.6.0'
file: '/templates/gitlab-ci-gitlab-package.yml'
variables:
# 2: set/override template variables
GLPKG_FILES: "build/*.tgz" # ⚠ this is only an example
Global configuration¶
The GitLab Package template uses some global configuration used throughout all jobs.
| Input / Variable | Description | Default value |
|---|---|---|
image / GLPKG_IMAGE |
The Docker image used to publish GitLab packages | docker.io/curlimages/curl:latest |
Jobs¶
glpkg-publish job¶
This job publishes files to GitLab Generic Package.
This job is bound to the publish stage and is executed on a Git tag with a semantic version pattern (v?[0-9]+\.[0-9]+\.[0-9]+, configurable).
It uses the following variables:
| Input / Variable | Description | Default value |
|---|---|---|
files / GLPKG_FILES |
Glob patterns matching files to include in the GitLab package ( |
none (mandatory) |
package / GLPKG_PACKAGE |
Name of the package to publish | $CI_PROJECT_NAME |
version / GLPKG_VERSION |
The package's version to publish | none (will default to $CI_COMMIT_TAG) |