github.com/goreleaser/goreleaser@v1.25.1/www/docs/scm/gitlab.md (about)

     1  # GitLab
     2  
     3  ## API Token
     4  
     5  GoReleaser requires an API token with the `api` scope selected to deploy the artifacts to GitLab.
     6  That token can either be a Personal, or a Project one.
     7  
     8  This token should be added to the environment variables as `GITLAB_TOKEN`.
     9  
    10  Alternatively, you can provide the GitLab token in a file.
    11  GoReleaser will check `~/.config/goreleaser/gitlab_token` by default, but you can change that in the `.goreleaser.yaml` file:
    12  
    13  ```yaml
    14  # .goreleaser.yaml
    15  env_files:
    16    gitlab_token: ~/.path/to/my/gitlab_token
    17  ```
    18  
    19  !!! warning
    20  
    21      If you use a project access token, make sure to set `use_package_registry`
    22      to `true` as well, otherwise it might not work.
    23  
    24  !!! warning
    25  
    26      If you are using a [protected variable](https://docs.gitlab.com/ee/ci/variables/#protected-cicd-variables)
    27      to store any of the values needed by goreleaser, ensure that you are protecting the tags as CI jobs in
    28      Gitlab only may access protected variables if the job is run for protected refs
    29      ([branches](https://docs.gitlab.com/ee/user/project/protected_branches.html),
    30      [tags](https://docs.gitlab.com/ee/user/project/protected_tags.html)).
    31  
    32  ## GitLab Enterprise or private hosted
    33  
    34  You can use GoReleaser with GitLab Enterprise by providing its URLs in the
    35  `.goreleaser.yml` configuration file. This takes a normal string, or a template value.
    36  
    37  ```yaml
    38  # .goreleaser.yml
    39  gitlab_urls:
    40    api: https://gitlab.mycompany.com/api/v4/
    41    download: https://gitlab.company.com
    42  
    43    # set to true if you use a self-signed certificate
    44    skip_tls_verify: false
    45  
    46    # set to true if you want to upload to the Package Registry rather than attachments
    47    # Only works with GitLab 13.5+
    48    #
    49    # Since: v1.3
    50    use_package_registry: false
    51  
    52    # Set this if you set GITLAB_TOKEN to the value of CI_JOB_TOKEN.
    53    #
    54    # Since: v1.11
    55    use_job_token: true
    56  ```
    57  
    58  If none are set, they default to GitLab's public URLs.
    59  
    60  !!! note
    61  
    62      Releasing to a private-hosted GitLab CE will only work for version `v12.9+`, due to dependencies
    63      on [release](https://docs.gitlab.com/ee/user/project/releases/index.html) functionality
    64      and [direct asset linking](https://docs.gitlab.com/ee/user/project/releases/index.html#permanent-links-to-release-assets).
    65  
    66  ## Generic Package Registry
    67  
    68  GitLab introduced the [Generic Package Registry](https://docs.gitlab.com/ee/user/packages/package_registry/index.html) in Gitlab 13.5.
    69  
    70  Normally, `goreleaser` uploads release files as "attachments", which may have [administrative limits](https://docs.gitlab.com/ee/user/admin_area/settings/account_and_limit_settings.html).
    71  Notably, hosted GitLab instances have a 10MB attachment limit, which cannot be changed.
    72  
    73  Uploading to the Generic Package Registry does not have this restriction.
    74  To use it instead, set `use_package_registry` to `true`.
    75  
    76  ```yaml
    77  # .goreleaser.yml
    78  gitlab_urls:
    79    use_package_registry: true
    80  ```
    81  
    82  ## Example release
    83  
    84  Here's an example of what the release might look like:
    85  
    86  <a href="https://gitlab.com/goreleaser/example/-/releases">
    87    <figure>
    88      <img src="https://img.carlosbecker.dev/goreleaser-gitlab.png"/>
    89      <figcaption>Example release on GitLab.</figcaption>
    90    </figure>
    91  </a>