Need help with semantic-release-action?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

cycjimmy
211 Stars 41 Forks MIT License 145 Commits 11 Opened issues

Description

GitHub Action for Semantic Release

Services available

!
?

Need anything else?

Contributors list

# 226,983
JavaScr...
devops
GitHub
CSS
71 commits
# 1,169
React N...
ugui
graysca...
fish-sh...
25 commits
# 71,745
GraphQL
Express
aurelia
adt
2 commits
# 1,638
gatsby-...
codepen
Twitch
Svelte
2 commits
# 77,729
PHP
Shell
guzzle
curl
1 commit
# 282,153
gatsby
Algolia
HTML
PHP
1 commit
# 137,216
Webpack
React N...
React
inline-...
1 commit
# 13,418
CSS
minific...
optimis...
npm
1 commit
# 83,111
gui-fra...
riotjs
cms-fra...
cpluspl...
1 commit
# 290,525
Python
Terrafo...
git-hoo...
pre-com...
1 commit
# 1,809
Atom
Markdow...
mariadb
Electro...
1 commit
# 113,784
Go
sanitiz...
validat...
golang
1 commit
# 61,796
TypeScr...
PHP
Node.js
Docker
1 commit

Semantic Release Action

Release date semantic-release npm license

GitHub Action for Semantic Release.

Usage

Step1: Set any Semantic Release Configuration in your repository.

Step2: Add Secrets in your repository for the Semantic Release Authentication Environment Variables.

Step3: Add a Workflow File to your repository to create custom automated processes.

Basic Usage:

steps:
  - name: Checkout
    uses: actions/[email protected]
  - name: Semantic Release
    uses: cycjimmy/[email protected]
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

IMPORTANT:

GITHUB_TOKEN
does not have the required permissions to operate on protected branches. If you are using this action for protected branches, replace
GITHUB_TOKEN
with Personal Access Token. If using the
@semantic-release/git
plugin for protected branches, avoid persisting credentials as part of
actions/[email protected]
by setting the parameter
persist-credentials: false
. This credential does not have the required permission to operate on protected branches.

Private Packages

If you are using this action to publish to the npm GitHub Packages Registry, then make sure that you configure this in your

package.json
file:
{
  "publishConfig": {
    "registry": "https://npm.pkg.github.com"
  }
}

Inputs

| Input Parameter | Required | Description | |:----------------:|:--------:|-------------| | semanticversion | false | Specify specifying version range for semantic-release. [Details] | | branches | false | The branches on which releases should happen.[Details]
Support for semantic-release above v16. | | branch | false | The branch on which releases should happen.[Details]
Only support for semantic-release older than v16. | | extra
plugins | false | Extra plugins for pre-install. [Details] | | dry_run | false | Whether to run semantic release in

dry-run
mode. [Details] | | extends | false | Use a sharable configuration [Details] |

semantic_version

{Optional Input Parameter} Specify specifying version range for semantic-release.
If no version range is specified, latest version will be used by default.

steps:
  - name: Checkout
    uses: actions/[email protected]
  - name: Semantic Release
    uses: cycjimmy/[email protected]
    with:
      semantic_version: 15.13.28  # It is recommended to specify specifying version range
                                  # for semantic-release.
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

It is recommended to manually specify a version of semantic-release to prevent errors caused during the official semantic-release upgrade.

branches

{Optional Input Parameter} The branches on which releases should happen.

branches
supports for semantic-release above v16.
steps:
  - name: Checkout
    uses: actions/[email protected]
  - name: Semantic Release
    uses: cycjimmy/[email protected]
    with:
      semantic_version: 16
      # you can set branches for semantic-release above v16.
      branches: |    
        [
          '+([0-9])?(.{+([0-9]),x}).x',
          'master', 
          'next', 
          'next-major', 
          {
            name: 'beta', 
            prerelease: true
          }, 
          {
            name: 'alpha', 
            prerelease: true
          }
        ]
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

branches
will override the
branches
attribute in your configuration file. If the attribute is not configured on both sides, the default is:
[
  '+([0-9])?(.{+([0-9]),x}).x',
  'master', 
  'next', 
  'next-major', 
  {name: 'beta', prerelease: true}, 
  {name: 'alpha', prerelease: true}
]

See configuration#branches for more information.

branch

{Optional Input Parameter} Similar to parameter

branches
. The branch on which releases should happen.
branch
only supports for semantic-release older than v16.
steps:
  - name: Checkout
    uses: actions/[email protected]
  - name: Semantic Release
    uses: cycjimmy/[email protected]
    with:
      semantic_version: 15.13.28
      # you can set branch for semantic-release older than v16.
      branch: your-branch
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

It will override the

branch
attribute in your configuration file. If the attribute is not configured on both sides, the default is
master
.

extra_plugins

{Optional Input Parameter} Extra plugins for pre-install.

The action can be used with

extra_plugins
option to specify plugins which are not in the default list of plugins of semantic release. When using this option, please make sure that these plugins are also mentioned in your semantic release config's plugins array.

For example, if you want to use

@semantic-release/git
and
@semantic-release/changelog
extra plugins, these must be added to
extra_plugins
in your actions file and
plugins
in your release config file as shown bellow:

Github Action Workflow:

yaml
steps:
  - name: Checkout
    uses: actions/[email protected]
  - name: Semantic Release
    uses: cycjimmy/[email protected]
    with:
      # You can specify specifying version range for the extra plugins if you prefer.
      extra_plugins: |
        @semantic-release/[email protected]
        @semantic-release/git
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

Similar to parameter

semantic_version
. It is recommended to manually specify a version of semantic-release plugins to prevent errors caused.

Release Config:

diff
  plugins: [
    .
+   "@semantic-release/changelog"
+   "@semantic-release/git",
  ]

dry_run

{Optional Input Parameter} Whether to run semantic release in

dry-run
mode.
It will override the dryRun attribute in your configuration file.
steps:
  - name: Checkout
    uses: actions/[email protected]
  - name: Semantic Release
    uses: cycjimmy/[email protected]
    with:
      dry_run: true
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

extends

The action can be used with

extends
option to extend an existing sharable configuration of semantic-release. Can be used in combination with
extra_plugins
.
steps:
  - name: Checkout
    uses: actions/[email protected]
  - name: Semantic Release
    uses: cycjimmy/[email protected]
    with:
      # You can extend an existing shareable configuration.
      extends: |
        @semantic-release/apm-config
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

Outputs

| Output Parameter | Description | |:-------------------------:|---| | newreleasepublished | Whether a new release was published (

true
or
false
) | | newreleaseversion | Version of the new release. (e.g.
1.3.0
) | | newreleasemajorversion | Major version of the new release. (e.g.
1
) | | new
releaseminorversion | Minor version of the new release. (e.g.
3
) | | newreleasepatchversion | Patch version of the new release. (e.g.
0
) | | new
releasechannel | The distribution channel on which the last release was initially made available (undefined for the default distribution channel). | | newreleasenotes | The release notes for the new release. | | lastrelease_version | Version of the previous release, if there was one. (e.g.
1.2.0
) |

Using Output Variables:

steps:
  - name: Checkout
    uses: actions/[email protected]
  - name: Semantic Release
    uses: cycjimmy/[email protected]
    id: semantic   # Need an `id` for output variables
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

  • name: Do something when a new release published if: steps.semantic.outputs.new_release_published == 'true' run: | echo ${{ steps.semantic.outputs.new_release_version }} echo ${{ steps.semantic.outputs.new_release_major_version }} echo ${{ steps.semantic.outputs.new_release_minor_version }} echo ${{ steps.semantic.outputs.new_release_patch_version }}

Changelog

See CHANGELOG.

License

This project is released under the MIT License.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.