Skip to content

Latest commit

 

History

History

release

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

GitHub Action Release

Description

GitHub Action that publishes a new release.

Configuration

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.

Usage

steps:
  - name: Release
    uses: open-turo/actions-node/release@v3
    with:
      ## example value for github-token provided below
      github-token: ${{ secrets.GITHUB_TOKEN }}
      ## example value for npm-auth-token provided below
      npm-auth-token: ${{ secrets.NPM_AUTH_TOKEN }}

You can specify an S3 bucket to cache node_modules in order to speed up dependency installation, in which case you will need to configure AWS credentials like so:

jobs:
  build:
    steps:
      - uses: aws-actions/configure-aws-credentials@v4
          with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
      - uses: open-turo/actions-node/release@v5
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          s3-bucket-name: <bucket-name>
          s3-bucket-region: <bucket-region>

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/checkout@v3 by setting the parameter persist-credentials: false. This credential does not have the required permission to operate on protected branches.

Inputs

name description required default
checkout-repo

Perform checkout as first step of action

false true
checkout-fetch-depth

The number of commits to fetch. 0 indicates all history for all branches and tags

false 0
github-token

GitHub token that can checkout the repository as well as create tags/releases against it. e.g. 'secrets.GITHUB_TOKEN'

true ${{ github.token }}
docker-config-file

Path to the docker config file (defaults to .docker-config.json) Must contain imageName, may contain dockerfile.

false .docker-config.json
docker-flavor

Docker flavor to use for docker metadata

false latest=false
dockerhub-user

username for dockerhub

false ""
dockerhub-password

password for dockerhub

false ""
npm-auth-token

The Node Package Manager (npm) authentication token. This token is used to authenticate against a private NPM registry configured via a .npmrc file.

false ""
npm-token

The Node Package Manager (npm) authentication token. This token is used to authenticate against the NPM registry.

false ""
dry-run

Whether to run semantic release in dry-run mode. It will override the dryRun attribute in your configuration file

false false
extra-plugins

Extra plugins for pre-install. You can also specify specifying version range for the extra plugins if you prefer. Defaults to install @open-turo/semantic-release-config.

false @open-turo/semantic-release-config
s3-bucket-name

S3 bucket name to cache node_modules to speed up dependency installation.

false ""
s3-bucket-region

S3 bucket region to cache node_modules to speed up dependency installation.

false ""

Outputs

name description
new-release-published

Whether a new release was published

new-release-version

Version of the new release

new-release-major-version

Major version of the new release

Runs

This action is a composite action.

Additional Examples

extra-plugins example

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:

steps:
  - name: Release
    uses: open-turo/actions-node/release@v1
    with:
      # You can specify specifying version range for the extra plugins if you prefer.
      github-token: ${{ secrets.GITHUB_TOKEN }}
      extra-plugins: |
        @semantic-release/changelog@3.0.0
        @semantic-release/git

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

Release Config:

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

dry-run example

jobs:
  build:
    steps:
      - name: Release
        uses: open-turo/actions-node/release@v1
        with:
          dry-run: true
          github-token: ${{ secrets.GITHUB_TOKEN }}

using output parameters example

jobs:
  build:
    steps:
      - name: Release
        uses: open-turo/actions-node/release@v1
        id: semantic # Need an `id` for output variables
        with:
          github-token: ${{ secrets.GITHUB_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 }}

Notes

  • By default, this action will perform actions/checkout as its first step.