Release on GitLab
Manually releasing your extension can be time-consuming and error-prone. In this guide, you'll configure your extension to use GitLab CI/CD to automatically create a release when you create a new tag.
Why use GitLab releases
GitLab lets you publish a public extension release while keeping your source code private.
For this setup, your project and releases are public, but the repository source is visible only to project members.
Configure project visibility
- Open your project settings page:
Replace example-group/azot-extension-example with your repository in the link below
https://gitlab.com/example-group/azot-extension-example/edit#js-shared-permissions
- Configure the following values:
- Project Visibility:
Public - Releases:
Everyone With Access - Repository:
Only Project Members(use this if you want to keep source code private)
Add GitLab CI workflow
INFO
If your repository was created from a ready template that already includes .gitlab-ci.yml, you can keep that file and only verify it matches the workflow below.
- In the root directory of your extension, create a
.gitlab-ci.ymlfile (or update your existing one) with the following content:
stages:
- build
- release
build_and_pack:
stage: build
image: node:24
cache:
key:
files:
- package-lock.json
paths:
- node_modules/
policy: pull-push
script:
- npm ci
- npm run build
- npx azot check --release
- npm pack
artifacts:
paths:
- "*.tgz"
- "*.zip"
- "*.azt"
- "package.json"
- "manifest.json"
- "README.md"
expire_in: 1 week
release_job:
stage: release
image: registry.gitlab.com/gitlab-org/cli:latest
script:
- glab auth login --hostname gitlab.com --token "$GLAB_TOKEN" --api-protocol https
- |
set -e
assets_list=""
for f in *.tgz *.zip *.azt package.json manifest.json README.md; do
if [ -f "$f" ]; then
assets_list="$assets_list $f"
fi
done
assets_list=$(echo $assets_list)
if [ -n "$assets_list" ]; then
old_ifs="$IFS"
IFS=' '
# shellcheck disable=SC2046
set -- $assets_list
IFS="$old_ifs"
glab release create "$CI_COMMIT_TAG" "$@" --name "$CI_COMMIT_TAG"
else
glab release create "$CI_COMMIT_TAG" --name "$CI_COMMIT_TAG"
fi
needs:
- job: build_and_pack
artifacts: true
workflow:
rules:
- if: $CI_COMMIT_TAG =~ /^v.*/- Commit and push the workflow:
git add .gitlab-ci.yml
git commit -m "Add GitLab release workflow"
git push origin mainCreate a Personal Access Token
The workflow uses glab and requires a Personal Access Token (PAT) to publish a release.
- Open your GitLab Personal Access Tokens page:
- Create a token with an
apiandwrite_registryscope. - Copy the token value and keep it safe. You will add it as a CI/CD variable.
Add GLAB_TOKEN CI/CD variable
- Open project CI/CD variables settings:
Replace example-group/azot-extension-example with your repository in the link below
https://gitlab.com/example-group/azot-extension-example/-/settings/ci_cd#js-cicd-variables-settings
- Select Add variable and configure:
- Key:
GLAB_TOKEN - Value: your PAT
- Masked: enabled
- Hidden: enabled
- Expanded: enabled
- Protected: disabled
Publish the first release
- Create a tag that matches the version in
package.json.
git tag -a v1.0.1 -m "v1.0.1"
git push origin v1.0.1- After the tag is pushed, GitLab detects the new tag and starts the pipeline automatically because of:
if: $CI_COMMIT_TAG =~ /^v.*/- When the pipeline finishes, open Deploy > Releases in your GitLab project and verify your release assets were uploaded.
You've successfully set up automatic GitLab releases for your extension.
- If this is the first release for this extension, you're now ready to Submit your extension.
- If this is an update to an already published extension, your users can now update to the latest version.
- Users who installed your extension from the repository link get the new release too: Azot checks GitLab releases periodically and, with automatic extension updates on, installs it for them in the background.