Skip to content
Snippets Groups Projects
Unverified Commit 83142865 authored by Gonzalo Servat's avatar Gonzalo Servat
Browse files

feat: add a job for running semantic-release in dry-run mode

parent 2eadd975
No related branches found
No related tags found
No related merge requests found
Pipeline #15428273 passed
Loading
Loading
@@ -3,25 +3,58 @@
# Note:
# * Runs in the release stage
 
semantic_release:
stage: release
image: node:18
variables:
GITLAB_URL: $CI_SERVER_URL
.semantic_release_common:
before_script:
- if [[ -n "$SEMANTIC_RELEASE_GITLAB_TOKEN" ]]; then
export GITLAB_TOKEN=$SEMANTIC_RELEASE_GITLAB_TOKEN;
fi
# Allow the semantic release job to fetch all the latest changes on the
# default branch before performing the semantic release.
# Required for delayed releases...
- git checkout "$CI_DEFAULT_BRANCH" && git pull && git fetch --tags
- npm install -g
@commitlint/cli@^17
@commitlint/config-conventional@^17
@semantic-release/gitlab@^9
conventional-changelog-conventionalcommits@^4
semantic-release@^19
semantic_release_dry_run:
stage: release
image: node:18
variables:
GITLAB_URL: $CI_SERVER_URL
before_script:
- !reference [.semantic_release_common, before_script]
script:
- semantic-release --dry-run --no-ci --branches $CI_COMMIT_BRANCH
rules:
# Only run on gitlab.com
- if: $CI_SERVER_HOST != "gitlab.com"
when: never
# Don't run on $CI_DEFAULT_BRANCH pushes
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: never
# Don't run for tags
- if: $CI_COMMIT_TAG
when: never
# # Do not run unless we have a token
- if: $GL_TOKEN == null && $GITLAB_TOKEN == null
when: never
# Only run for git pushes to branches
- if: $CI_PIPELINE_SOURCE == "push"
semantic_release:
stage: release
image: node:18
variables:
GITLAB_URL: $CI_SERVER_URL
before_script:
- !reference [.semantic_release_common, before_script]
# Allow the semantic release job to fetch all the latest changes on the
# default branch before performing the semantic release.
# Required for delayed releases...
- git checkout "$CI_DEFAULT_BRANCH" && git pull && git fetch --tags
script:
- semantic-release
after_script: |
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment