gitlab ci templates to extend autodevops
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ci-templates/Semantic-Release-Base.gitla...

39 lines
1.1 KiB

---
# You need to setup some CI/CD variables
# I recommend to set it on Group to make things easier
# see https://docs.gitlab.com/ee/ci/examples/semantic-release.html#set-up-cicd-variables
.caching_node: &caching_node
cache:
key: semantic-release-cache
paths:
- node_modules/
semantic-release:
image: node:lts
stage: review
variables:
NPM_TOKEN: "${CI_JOB_TOKEN}"
before_script:
- yarn add semantic-release @semantic-release/git @semantic-release/gitlab @semantic-release/changelog semantic-release-cli
- rm package.json yarn.lock
- |
cat <<-EOF >> .releaserc.yml
branches:
- $CI_COMMIT_BRANCH
plugins:
- "@semantic-release/commit-analyzer"
- "@semantic-release/release-notes-generator"
- "@semantic-release/changelog"
- "@semantic-release/gitlab"
- "@semantic-release/git"
EOF
script:
- ./node_modules/.bin/semantic-release
rules:
- exists:
- package.json # disable on package.json exists
when: never
- if: "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"
when: always
<<: *caching_node