Promise was checked before resolving, so the first early return never happened (Promises are truthy) and the subsequent `if (lastRelease.version)` check produced an error in some cases(`lastRelease` undefined, "Error: TypeError: Cannot read properties of undefined (reading 'version')").
Observed for semantic-release-action 4.2.2 and 5.0.0 with semantic_version > 24.2.6 (not observed with 24.2.6).
The PR prevents reading properties of "undefined".
@ -18,16 +18,16 @@ GitHub Action for [Semantic Release][semantic-url].
```yaml
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
uses: cycjimmy/semantic-release-action@v6
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](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line). If using the `@semantic-release/git` plugin for protected branches, avoid persisting credentials as part of `actions/checkout@v4` by setting the parameter `persist-credentials: false`. This credential does not have the required permission to operate on protected branches.
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). If using the `@semantic-release/git` plugin for protected branches, avoid persisting credentials as part of `actions/checkout@v5` by setting the parameter `persist-credentials: false`. This credential does not have the required permission to operate on protected branches.
#### Private Packages
@ -51,6 +51,7 @@ then make sure that you configure this in your `package.json` file:
| 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)] |
| ci | false | Whether to run semantic release with CI support. [[Details](#ci)]<br>Support for **semantic-release above v16**. |
| unset_gha_env | false | Whether to unset the GITHUB_ACTIONS environment variable. |
| extends | false | Use a sharable configuration [[Details](#extends)] |
| working_directory | false | Use another working directory for semantic release [[Details](#working_directory)] |
| tag_format | false | Specify format of tag (useful for monorepos) |
@ -62,9 +63,9 @@ then make sure that you configure this in your `package.json` file:
```yaml
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
uses: cycjimmy/semantic-release-action@v6
with:
semantic_version: 19.0.5 # It is recommended to specify a version range
# for semantic-release when using
@ -74,7 +75,7 @@ steps:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
```
If no version range is specified with `cycjimmy/semantic-release-action@v4` then [semantic-release](https://github.com/semantic-release/semantic-release/) version [21.1.1](https://github.com/semantic-release/semantic-release/releases/tag/v21.1.1) is used.
If no version range is specified with `cycjimmy/semantic-release-action@v6` then [semantic-release](https://github.com/semantic-release/semantic-release/) version [24.2.7](https://github.com/semantic-release/semantic-release/releases/tag/v25.0.2) is used.
#### branches
> {Optional Input Parameter} The branches on which releases should happen.<br>`branches` supports for **semantic-release above v16**.
@ -82,9 +83,9 @@ If no version range is specified with `cycjimmy/semantic-release-action@v4` then
```yaml
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
uses: cycjimmy/semantic-release-action@v6
with:
semantic_version: 16
# you can set branches for semantic-release above v16.
@ -128,9 +129,9 @@ See [configuration#branches](https://semantic-release.gitbook.io/semantic-releas
```yaml
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
uses: cycjimmy/semantic-release-action@v6
with:
semantic_version: 15.13.28
# you can set branch for semantic-release older than v16.
@ -153,9 +154,9 @@ Github Action Workflow:
```yaml
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
uses: cycjimmy/semantic-release-action@v6
with:
# You can specify specifying version range for the extra plugins if you prefer.
extra_plugins: |
@ -183,9 +184,9 @@ Release Config:
```yaml
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
uses: cycjimmy/semantic-release-action@v6
with:
dry_run: true
env:
@ -199,9 +200,9 @@ steps:
```yaml
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
uses: cycjimmy/semantic-release-action@v6
with:
ci: false
env:
@ -217,9 +218,9 @@ The action can be used with `extends` option to extend an existing [sharable con
```yaml
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
uses: cycjimmy/semantic-release-action@v6
with:
# You can extend an existing shareable configuration.
# And you can specify version range for the shareable configuration if you prefer.
@ -237,9 +238,9 @@ This action run semantic release in the github provided workspace by default. Yo
```yaml
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
uses: cycjimmy/semantic-release-action@v6
with:
# You can select another working directory like a subdirectory for example.
working_directory: ./code
@ -254,9 +255,9 @@ The default tag format on semantic-release is `v{version}`. You can override tha
```yaml
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
uses: cycjimmy/semantic-release-action@v6
with:
tag_format: custom-v${version}
env:
@ -264,6 +265,29 @@ steps:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
```
#### unset_gha_env
Setting this to true will unset the `GITHUB_ACTIONS` environment variable. This can be useful when wanting to validate things such as merging of a PR would create a valid release.
* **deps:** update semantic-release to version 25 ([9246c0b](https://github.com/cycjimmy/semantic-release-action/commit/9246c0bd17405b1f20450501f39234912258bc50))
* further fix of result handling in windUpJob.task.js ([451bf1f](https://github.com/cycjimmy/semantic-release-action/commit/451bf1fa96343272b4efadb5731fe2e25073d24f)), closes [#264](https://github.com/cycjimmy/semantic-release-action/issues/264)
* improves result handling in windUpJob.task.js ([4267eee](https://github.com/cycjimmy/semantic-release-action/commit/4267eee56034cc3ee6f2fef9bdc3cc125ca073db))
* **cleanupNpmrc.task.js:** Use @actions/io to remove .npmrc ([b7db0cb](https://github.com/cycjimmy/semantic-release-action/commit/b7db0cbbf5f42eb8fe027828c236fbc340b5429e))
* add ability to unset GITHUB_ACTION env var ([266ea7e](https://github.com/cycjimmy/semantic-release-action/commit/266ea7eb8c90943aa9cddd3b0ed326d5e8784a26))