Release you action with Semantic Release. Zero configuration with best practices.
- The
dist
files of your action are pushed with tags. See semantic-release/git#assets for more information. - Automatically push the tags
v1
andv1.0
, pointing them tov1.0.x
. This is a best practice for releasing GitHub Actions as also described in the GitHub Docs for creating actions - Release and maintaining actions.
name: Release
on:
push:
branches:
- master
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install
run: yarn install
- name: Build
run: yarn build
- name: Semantic Release
uses: wow-actions/release-github-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
See semantic-release/git#environment-variables for more information.
Variable | Description | Default |
---|---|---|
GITHUB_TOKEN |
The GitHub token for authentication. | ${{ secrets.GITHUB_TOKEN }} |
GIT_AUTHOR_NAME |
The author name associated with the release commit. See Git environment variables. | @semantic-release-bot. |
GIT_AUTHOR_EMAIL |
The author email associated with the release commit. See Git environment variables. | @semantic-release-bot email address. |
GIT_COMMITTER_NAME |
The committer name associated with the release commit. See Git environment variables. | @semantic-release-bot. |
GIT_COMMITTER_EMAIL |
The committer email associated with the release commit. See Git environment variables. | @semantic-release-bot email address. |
- name: Semantic Release
uses: wow-actions/release-github-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_AUTHOR_NAME: Your-Github-Username
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: Your-Github-Username
GIT_COMMITTER_EMAIL: [email protected]
Name | Required | Description |
---|---|---|
cwd |
false | Use another working directory for semantic release [Details] |
dry_run |
false | Whether to run semantic release in dry-run mode. [Details] |
branches |
false | The branches on which releases should happen.[Details] |
commit_analyzer |
false | Options for semantic-release/commit-analyzer. [Details] |
release_notes_generator |
false | Options for semantic-release/release-notes-generator. [Details] |
changelog |
false | Options for semantic-release/changelog. [Details] |
github |
false | Options for semantic-release/github. [Details] |
git |
false | Options for semantic-release/git. [Details] |
This action run semantic release in the github provided workspace by default. You can override it by setting another working directory.
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Semantic Release
uses: wow-actions/release-github-action@v2
with:
# You can select another working directory like a subdirectory for example.
cwd: ./code
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Whether to run semantic release in dry-run
mode.
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Semantic Release
uses: wow-actions/release-github-action@v2
with:
dry_run: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
The branches on which releases should happen. See configuration#branches for more information.
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Semantic Release
uses: wow-actions/release-github-action@v2
with:
# JSON or Yaml
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 }}
Options for semantic-release/commit-analyzer. User-specified config will be merged(by Object.assign) to the following default value.
{
preset: 'angular',
releaseRules: [
{ breaking: true, release: 'major' },
{ revert: true, release: 'patch' },
{ type: 'feat', release: 'minor' },
{ type: 'build', release: 'patch' },
{ type: 'ci', release: false },
{ type: 'chore', release: false },
{ type: 'docs', release: 'patch' },
{ type: 'perf', release: 'patch' },
{ type: 'refactor', release: 'patch' },
{ type: 'style', release: 'patch' },
{ type: 'test', release: 'patch' },
{ scope: 'no-release', release: false },
],
parserOpts: {
noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES'],
},
},
Options for semantic-release/release-notes-generator. User-specified config will be merged(by Object.assign) to the following default value.
{
}
Options for semantic-release/changelog. User-specified config will be merged(by Object.assign) to the following default value.
{
}
Options for semantic-release/github. User-specified config will be merged(by Object.assign) to the following default value.
{
addReleases: 'bottom',
}
Options for semantic-release/git. User-specified config will be merged(by Object.assign) to the following default value.
{
assets: ['dist/**/*', 'package.json', 'CHANGELOG.md'],
}
Name | Description |
---|---|
last_release_version |
Version of the previous release, if there was one. (e.g. 1.2.0 ) |
last_release_git_head |
The sha of the last commit being part of the last release, if there was one. |
last_release_git_tag |
The Git tag associated with the last release, if there was one. |
new_release_published |
Whether a new release was published. The return value is in the form of a string. ("true" or "false" ) |
new_release_version |
Version of the new release. (e.g. "1.3.0" ) |
new_release_major_version |
Major version of the new release. (e.g. "1" ) |
new_release_minor_version |
Minor version of the new release. (e.g. "3" ) |
new_release_patch_version |
Patch version of the new release. (e.g. "0" ) |
new_release_channel |
The distribution channel on which the last release was initially made available (undefined for the default distribution channel). |
new_release_notes |
The release notes for the new release. |
new_release_git_head |
The sha of the last commit being part of the new release |
new_release_git_tag |
The Git tag associated with the new release. |
Using Output Variables:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Semantic Release
uses: wow-actions/release-github-action@v2
# Need an `id` for output variables
id: semantic
env:
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 }}
echo ${{ steps.semantic.outputs.new_release_minor_version }}
echo ${{ steps.semantic.outputs.new_release_patch_version }}
The scripts and documentation in this project are released under the MIT License