publish-gitlab-release
v0.0.6
Published
publish-gitlab-release is a command-line tool that automates the process of creating GitLab releases, including generating changelogs, adding comments to merge requests and linked issues, all while providing flexibility in versioning schemes.
Downloads
3
Readme
publish-gitlab-release
publish-gitlab-release
is a command-line tool designed to simplify the process of creating a Git tag and a corresponding GitLab release.
The tool automates the collection of commits made since the last tag, along with all associated merge requests and their linked issues. It also adds comments to merge requests and their linked issues, providing better visibility into the changes included in each release. Additionally, it generates a basic changelog based on raw commit messages.
Unlike some other tools like semantic release, publish-gitlab-release
doesn't enforce a specific versioning scheme. It is flexible and works exclusively with GitLab via their API.
🌟 Features
- Create a Git tag and publish a GitLab release with a single command.
- Automatically add comments to Merge Requests and their linked issues for better visibility.
- Generate a basic changelog for the GitLab release.
🧰 Requirements
- Node 18 (or higher)
- Gitlab
- Your latest Git tag is always the tag since last release
🚀 Usage
To use publish-gitlab-release
, invoke it using npx with the desired version number:
npx publish-gitlab-release -v "1.2.3" [options]
🛠️ Options
-v, --version
(required)
Specifies the version name to be used for the Git tag and the Gitlab release. This option is required and should be used to define the version of the release.
-t, --token
(required)
Gitlab API token. Unfortunately the CI_JOB_TOKEN
has not enough rights, so that a personal access token or a project access token is required. Go to your project settings and then Access Tokens. Create a token with the scope api and add it to variables under the section CI/CD.
--ref
(optional)
Git ref that should be tagged. If provided, the specified Git ref will be tagged with the version defined using the -v
option. If not provided, the tool will use the given environment variable CI_COMMIT_SHA
from Gitlab pipelines.
--host
(optional)
Gitlab URI. Use this option to specify a custom Gitlab host URL. Within Gitlab pipelines the tool will use the environment variables CI_SERVER_PROTOCOL
, CI_SERVER_HOST
and CI_SERVER_PORT
. Fallback is gitlab.com
.
--project
(optional)
Gitlab project ID. Use this option to specify the ID of the Gitlab project where the release should be published. If not provided, the tool will use the given variable CI_PROJECT_ID
from Gitlab pipelines.
💻 CI example
publish-release:
image: node:20.4.0
script:
- npx publish-gitlab-release --version "$VERSION" --token "$GITLAB_RELEASE_TOKEN"
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_TAG == null'
👏 Credits
- semantic release A powerful release publishing tool with extensive plugin support, automating versioning and publishing based on commit history
- @gitbeaker/rest provides typed access to the Gitlab API, enhancing our project's capabilities
- blog post Actually you don’t need 'semantic-release' for semantic release inspired the creation of this tool, tailored to my specific needs