Skip to content

Instantly share code, notes, and snippets.

@ujlbu4
Created August 1, 2020 20:52
Show Gist options
  • Save ujlbu4/15a305f2e53cb487c39c9484e660903a to your computer and use it in GitHub Desktop.
Save ujlbu4/15a305f2e53cb487c39c9484e660903a to your computer and use it in GitHub Desktop.
semantic release yaml config
branches: ['master']
ci: true
debug: true
dryRun: false
# repositoryUrl: β€” no need, will use from git origin
tagFormat: '${version}'
# Global plugin options (will be passed to all plugins)
preset: 'conventionalcommits'
gitlabUrl: 'http://gitlab.your-domain.com/'
# it possible to set slack or mattermost incoming-hook-url
slackWebhook: 'https://mattermost.your-domain.com/hooks/xxxxhhkrxxxblalbla'
###
# Setup plugins:
# https://github.com/semantic-release/semantic-release/blob/caribou/docs/usage/plugins.md
###
# Responsible for verifying conditions necessary to proceed with the release:
# configuration is correct, authentication token are valid, etc...
verifyConditions:
- '@semantic-release/changelog'
# Verify the presence and the validity of the configuration
- '@semantic-release/git'
# Verify the presence and the validity of the Git authentication
# and release configuration
- '@semantic-release/gitlab'
# Verify the presence and the validity of the GitLab authentication
# and release configuration
- 'semantic-release-slack-bot'
# Verify that the environment variable SLACK_WEBHOOK has been defined
# Responsible for determining the type of the next release (major, minor or patch).
# If multiple plugins with a analyzeCommits step are defined, the release type will be
# the highest one among plugins output.
# Look details at: https://github.com/semantic-release/commit-analyzer#configuration
analyzeCommits:
- path: '@semantic-release/commit-analyzer'
# Determine the type of release by analyzing commits with conventional-changelog
releaseRules:
- breaking: true
release: major
- type: build # Changes that affect the build system or external dependencies
# (example scopes: gulp, broccoli, npm)
release: patch
- type: chore # Other changes that don't modify src or test files
release: false
- type: ci # Changes to our CI configuration files and scripts
release: false
- type: docs # Documentation only changes
release: patch
- type: feat # A new feature
release: minor
- type: fix # A bug fix
release: patch
- type: perf # A code change that improves performance
release: patch
- type: refactor # A code change that neither fixes a bug nor adds a feature
release: false
- type: revert # Reverts a previous commit
release: patch
- type: style # Changes that do not affect the meaning of the code
# (white-space, formatting, missing semi-colons, etc)
release: false
- type: test # Adding missing tests or correcting existing tests
release: false
# Responsible for generating the content of the release note.
# If multiple plugins with a generateNotes step are defined,
# the release notes will be the result of the concatenation of each plugin output.
generateNotes:
- path: '@semantic-release/release-notes-generator'
writerOpts:
groupBy: 'type'
commitGroupsSort: 'title'
commitsSort: 'header'
linkCompare: true
linkReferences: true
parserOpts:
# detect JIRA issues in merge commits
issuePrefixes: ['DEV-']
mergePattern: "^Merge branch '(.*)' into (.*)$"
mergeCorrespondence: ['branch_src', 'branch_dst']
presetConfig:
types: # looks like it only works with 'conventionalcommits' preset
- type: 'build'
section: '🦊 CI/CD'
hidden: false
- type: 'chore'
section: 'Other'
hidden: false
- type: 'ci'
section: '🦊 CI/CD'
hidden: false
- type: 'docs'
section: 'πŸ“” Docs'
hidden: false
- type: 'example'
section: 'πŸ“ Examples'
hidden: false
- type: 'feat'
section: 'πŸš€ Features'
hidden: false
- type: 'fix'
section: 'πŸ›  Fixes'
hidden: false
- type: 'perf'
section: '⏩ Performance'
- type: 'refactor'
section: ':scissors: Refactor'
hidden: false
- type: 'revert'
section: 'πŸ™…β€β™‚οΈ Reverts'
- type: 'style'
section: 'πŸ’ˆ Style'
- type: 'test'
section: 'πŸ§ͺ Tests'
hidden: false
# Responsible for preparing the release, for example creating or updating files
# such as package.json, CHANGELOG.md, documentation or compiled assets
# and pushing a commit.
prepare:
- path: '@semantic-release/exec'
# Execute shell command to set package version
cmd: './deployment/version-plaintext-set.sh ${nextRelease.version}'
- path: '@semantic-release/exec'
cmd: './deployment/version-oas-set.sh ${nextRelease.version} openapi.yaml'
- path: '@semantic-release/changelog'
# Create or update the changelog file in the local project repository
- path: '@semantic-release/exec'
- path: '@semantic-release/git'
# Push a release commit and tag, including configurable files
message: 'RELEASE: ${nextRelease.version}'
assets: ['CHANGELOG.md', 'version', 'openapi.yaml']
# Responsible for publishing the release.
publish:
- path: '@semantic-release/gitlab'
# Publish a GitLab release
# (https://docs.gitlab.com/ce/user/project/releases/index.html#add-release-notes-to-git-tags)
success:
- path: 'semantic-release-slack-bot'
# Publish a message about the success to a slack channel
notifyOnSuccess: true
markdownReleaseNotes: false
onSuccessTemplate:
# // example params for mattermost
channel: 'your-channel-name'
text: 'Hello, this is some text :tada:'
attachments:
- color: '#00c100'
title: '$package_name'
title_link: '$repo_url'
pretext: 'This is optional pretext that shows above the attachment.'
text: '$release_notes'
footer: 'version: $npm_package_version'
# // example blocks for slack
# blocks:
# - type: 'section'
# text:
# type: 'mrkdwn'
# text: '*`$package_name` released!*'
# - type: 'section'
# text:
# type: 'mrkdwn'
# text: '$release_notes'
# - type: 'divider'
# - type: 'context'
# elements:
# - type: 'mrkdwn'
# text: "πŸ“¦ *assets:* <$repo_url/releases/$npm_package_version|$npm_package_version>"
fail:
- path: 'semantic-release-slack-bot'
# publish a message about failure to a slack channel
notifyOnFail: true
@pranaymodukuru
Copy link

pranaymodukuru commented Feb 23, 2023

Can you share a repo where this worked? This is to see how the changelog looks. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment