Skip to content

Commit

Permalink
fix: rescope
Browse files Browse the repository at this point in the history
  • Loading branch information
FlippAre committed Apr 30, 2020
1 parent e951df7 commit 5b03139
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 54 deletions.
112 changes: 63 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
# Semantic Release Action

![][workflows-badge-image]
[![Release date][release-date-image]][release-url]
[![semantic-release][semantic-image]][semantic-url]
[![npm license][license-image]][license-url]

GitHub Action for [Semantic Release](https://github.com/semantic-release/semantic-release).
GitHub Action for [Semantic Release](https://github.com/semantic-release/semantic-release).

## Usage

### Step1: Set any [Semantic Release Configuration](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#configuration) in your repository.

### Step2: [Add Secrets](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets) in your repository for the [Semantic Release Authentication](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/ci-configuration.md#authentication) Environment Variables.

### Step3: Add a [Workflow File](https://help.github.com/en/articles/workflow-syntax-for-github-actions) to your repository to create custom automated processes.

#### Basic Usage:

```yaml
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
uses: lundalogik/semantic-release-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand All @@ -29,47 +32,51 @@ steps:
If you are using this action for protected branches, replace `GITHUB_TOKEN` with [Personal Access Token](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line).

### Inputs
| Input Parameter | Required | Description |
|:----------------:|:--------:|-------------|
| semantic_version | false | Specify specifying version range for semantic-release. [[Details](#semantic_version)] |
| branches | false | The branches on which releases should happen.[[Details](#branches)]<br>Support for **semantic-release above v16**. |
| branch | false | The branch on which releases should happen.[[Details](#branch)]<br>Only support for **semantic-release older than v16**. |
| extra_plugins | false | Extra plugins for pre-install. [[Details](#extra_plugins)] |
| dry_run | false | Whether to run semantic release in `dry-run` mode. [[Details](#dry_run)] |
| extends | false | Use a sharable configuration [[Details](#extends)] |

| Input Parameter | Required | Description |
| :--------------: | :------: | ------------------------------------------------------------------------------------------------------------------------ |
| semantic_version | false | Specify specifying version range for semantic-release. [[Details](#semantic_version)] |
| branches | false | The branches on which releases should happen.[[Details](#branches)]<br>Support for **semantic-release above v16**. |
| branch | false | The branch on which releases should happen.[[Details](#branch)]<br>Only support for **semantic-release older than v16**. |
| extra_plugins | false | Extra plugins for pre-install. [[Details](#extra_plugins)] |
| dry_run | false | Whether to run semantic release in `dry-run` mode. [[Details](#dry_run)] |
| extends | false | Use a sharable configuration [[Details](#extends)] |

#### semantic_version

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

```yaml
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
uses: lundalogik/semantic-release-action@v2
with:
semantic_version: 15.13.28 # It is recommended to specify specifying version range
# for semantic-release.
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.*
_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.<br>`branches` supports for **semantic-release above v16**.

```yaml
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
uses: lundalogik/semantic-release-action@v2
with:
semantic_version: 16
# you can set branches for semantic-release above v16.
branches: |
branches: |
[
'+([0-9])?(.{+([0-9]),x}).x',
'master',
Expand All @@ -89,29 +96,31 @@ steps:
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:
`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},
'master',
'next',
'next-major',
{name: 'beta', prerelease: true},
{name: 'alpha', prerelease: true}
]
```

See [configuration#branches](https://semantic-release.gitbook.io/semantic-release/usage/configuration#branches) for more information.

#### branch

> {Optional Input Parameter} Similar to parameter `branches`. The branch on which releases should happen.<br>`branch` only supports for **semantic-release older than v16**.

```yaml
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
uses: lundalogik/semantic-release-action@v2
with:
semantic_version: 15.13.28
# you can set branch for semantic-release older than v16.
Expand All @@ -124,19 +133,21 @@ steps:
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](https://semantic-release.gitbook.io/semantic-release/usage/plugins#default-plugins). When using this option, please make sure that these plugins are also mentioned in your [semantic release config's plugins](https://semantic-release.gitbook.io/semantic-release/usage/configuration#plugins) array.
> {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](https://semantic-release.gitbook.io/semantic-release/usage/plugins#default-plugins). When using this option, please make sure that these plugins are also mentioned in your [semantic release config's plugins](https://semantic-release.gitbook.io/semantic-release/usage/configuration#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](https://semantic-release.gitbook.io/semantic-release/usage/configuration#configuration-file) as shown bellow:

Github Action Workflow:

```yaml
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
uses: lundalogik/semantic-release-action@v2
with:
# You can specify specifying version range for the extra plugins if you prefer.
extra_plugins: |
Expand All @@ -147,9 +158,10 @@ steps:
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.*
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: [
.
Expand All @@ -159,14 +171,15 @@ Release Config:
```

#### dry_run

> {Optional Input Parameter} Whether to run semantic release in `dry-run` mode.<br>It will override the dryRun attribute in your configuration file.

```yaml
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
uses: lundalogik/semantic-release-action@v2
with:
dry_run: true
env:
Expand All @@ -175,6 +188,7 @@ steps:
```

#### extends

The action can be used with `extends` option to extend an existing [sharable configuration](https://semantic-release.gitbook.io/semantic-release/usage/shareable-configurations) of semantic-release. Can be used in combination with `extra_plugins`.

_github-action_
Expand All @@ -184,7 +198,7 @@ steps:
- name: Checkout
uses: actions/checkout@v2
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
uses: lundalogik/semantic-release-action@v2
with:
# You can specify specifying version range for the extra plugins if you prefer.
extends: |
Expand All @@ -195,27 +209,29 @@ steps:
```

### Outputs
| Output Parameter | Description |
|:-------------------------:|---|
| new_release_published | Whether a new release was published (`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_notes | The release notes for the new release. |

| Output Parameter | Description |
| :-----------------------: | ------------------------------------------------------- |
| new_release_published | Whether a new release was published (`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_notes | The release notes for the new release. |

#### Using Output Variables:

```yaml
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
id: semantic # Need an `id` for output variables
uses: lundalogik/semantic-release-action@v2
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: |
Expand All @@ -226,22 +242,20 @@ steps:
```
## Changelog
See [CHANGELOG][changelog-url].
## License
This project is released under the [MIT License][license-url].
<!-- Links: -->
[workflows-badge-image]: https://github.com/cycjimmy/semantic-release-action/workflows/Test%20Release/badge.svg
[release-date-image]: https://img.shields.io/github/release-date/cycjimmy/semantic-release-action
[release-url]: https://github.com/cycjimmy/semantic-release-action/releases
[workflows-badge-image]: https://github.com/lundalogik/semantic-release-action/workflows/Test%20Release/badge.svg
[release-date-image]: https://img.shields.io/github/release-date/lundalogik/semantic-release-action
[release-url]: https://github.com/lundalogik/semantic-release-action/releases
[semantic-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
[semantic-url]: https://github.com/semantic-release/semantic-release
[license-image]: https://img.shields.io/npm/l/@cycjimmy/semantic-release-action.svg
[license-url]: https://github.com/cycjimmy/semantic-release-action/blob/master/LICENSE
[changelog-url]: https://github.com/cycjimmy/semantic-release-action/blob/master/docs/CHANGELOG.md
[license-image]: https://img.shields.io/npm/l/@lundalogik/semantic-release-action.svg
[license-url]: https://github.com/lundalogik/semantic-release-action/blob/master/LICENSE
[changelog-url]: https://github.com/lundalogik/semantic-release-action/blob/master/docs/CHANGELOG.md
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@cycjimmy/semantic-release-action",
"name": "@lundalogik/semantic-release-action",
"version": "2.3.0",
"description": "GitHub Action for Semantic Release",
"main": "index.js",
Expand All @@ -8,18 +8,18 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/cycjimmy/semantic-release-action.git"
"url": "git+https://github.com/lundalogik/semantic-release-action.git"
},
"keywords": [
"semantic-release",
"action"
],
"author": "cycjimmy <[email protected]> (https://github.com/cycjimmy)",
"author": "lundalogik <[email protected]> (https://github.com/lundalogik)",
"license": "MIT",
"bugs": {
"url": "https://github.com/cycjimmy/semantic-release-action/issues"
"url": "https://github.com/lundalogik/semantic-release-action/issues"
},
"homepage": "https://github.com/cycjimmy/semantic-release-action#readme",
"homepage": "https://github.com/lundalogik/semantic-release-action#readme",
"dependencies": {
"@actions/core": "^1.2.3",
"@cycjimmy/awesome-js-funcs": "^2.3.0"
Expand Down

0 comments on commit 5b03139

Please sign in to comment.