Compare commits

..

No commits in common. "main" and "v3.2.0" have entirely different histories.
main ... v3.2.0

17 changed files with 6768 additions and 3531 deletions

View file

@ -9,6 +9,3 @@ updates:
directory: / directory: /
schedule: schedule:
interval: daily interval: daily
ignore:
- dependency-name: "semantic-release"
versions: [ "20.x", "21.x" ]

View file

@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v3
- name: Semantic Release - name: Semantic Release
uses: ./ uses: ./

View file

@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v3
- name: Semantic Release - name: Semantic Release
uses: ./ uses: ./
@ -46,9 +46,9 @@ jobs:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Setup Node.js with GitHub Package Registry - name: Setup Node.js with GitHub Package Registry
uses: actions/setup-node@v6 uses: actions/setup-node@v3
with: with:
node-version: 24 node-version: 16
registry-url: 'https://npm.pkg.github.com' registry-url: 'https://npm.pkg.github.com'
scope: 'cycjimmy' scope: 'cycjimmy'

View file

@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v3
- name: Semantic Release - name: Semantic Release
uses: ./ uses: ./
@ -59,7 +59,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v6 uses: actions/checkout@v3
- name: Semantic Release - name: Semantic Release
uses: ./ uses: ./

View file

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2019-2024 cycjimmy Copyright (c) 2019-2020 cycjimmy
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

112
README.md
View file

@ -18,16 +18,16 @@ GitHub Action for [Semantic Release][semantic-url].
```yaml ```yaml
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v3
- name: Semantic Release - name: Semantic Release
uses: cycjimmy/semantic-release-action@v6 uses: cycjimmy/semantic-release-action@v3
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
``` ```
**IMPORTANT**: `GITHUB_TOKEN` does not have the required permissions to operate on protected branches. **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@v5` 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@v3` by setting the parameter `persist-credentials: false`. This credential does not have the required permission to operate on protected branches.
#### Private Packages #### Private Packages
@ -45,37 +45,32 @@ then make sure that you configure this in your `package.json` file:
### Inputs ### Inputs
| Input Parameter | Required | Description | | Input Parameter | Required | Description |
|:-----------------:|:--------:|--------------------------------------------------------------------------------------------------------------------------| |:-----------------:|:--------:|--------------------------------------------------------------------------------------------------------------------------|
| semantic_version | false | Specify version range for semantic-release. [[Details](#semantic_version)] | | 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**. | | 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**. | | 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)] | | 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)] | | 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)] | | extends | false | Use a sharable configuration [[Details](#extends)] |
| working_directory | false | Use another working directory for semantic release [[Details](#working_directory)] | | working_directory | false | Use another working directory for semantic release [[Details](#working_directory)] |
| tag_format | false | Specify format of tag (useful for monorepos) |
| repository_url | false | The Git repository url. If no repository url specified, current repository will be used by default. |
#### semantic_version #### semantic_version
> {Optional Input Parameter} Specify version range for semantic-release. > {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 ```yaml
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v3
- name: Semantic Release - name: Semantic Release
uses: cycjimmy/semantic-release-action@v6 uses: cycjimmy/semantic-release-action@v3
with: with:
semantic_version: 19.0.5 # It is recommended to specify a version range semantic_version: 15.13.28 # It is recommended to specify specifying version range
# for semantic-release when using # for semantic-release.
# semantic-release-action lower than @v4
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
``` ```
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. *It is recommended to manually specify a version of semantic-release to prevent errors caused during the official semantic-release upgrade.*
#### branches #### branches
> {Optional Input Parameter} The branches on which releases should happen.<br>`branches` supports for **semantic-release above v16**. > {Optional Input Parameter} The branches on which releases should happen.<br>`branches` supports for **semantic-release above v16**.
@ -83,9 +78,9 @@ If no version range is specified with `cycjimmy/semantic-release-action@v6` then
```yaml ```yaml
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v3
- name: Semantic Release - name: Semantic Release
uses: cycjimmy/semantic-release-action@v6 uses: cycjimmy/semantic-release-action@v3
with: with:
semantic_version: 16 semantic_version: 16
# you can set branches for semantic-release above v16. # you can set branches for semantic-release above v16.
@ -129,9 +124,9 @@ See [configuration#branches](https://semantic-release.gitbook.io/semantic-releas
```yaml ```yaml
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v3
- name: Semantic Release - name: Semantic Release
uses: cycjimmy/semantic-release-action@v6 uses: cycjimmy/semantic-release-action@v3
with: with:
semantic_version: 15.13.28 semantic_version: 15.13.28
# you can set branch for semantic-release older than v16. # you can set branch for semantic-release older than v16.
@ -154,13 +149,13 @@ Github Action Workflow:
```yaml ```yaml
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v3
- name: Semantic Release - name: Semantic Release
uses: cycjimmy/semantic-release-action@v6 uses: cycjimmy/semantic-release-action@v3
with: with:
# You can specify specifying version range for the extra plugins if you prefer. # You can specify specifying version range for the extra plugins if you prefer.
extra_plugins: | extra_plugins: |
@semantic-release/changelog@6.0.0 @semantic-release/changelog@3.0.0
@semantic-release/git @semantic-release/git
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -184,9 +179,9 @@ Release Config:
```yaml ```yaml
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v3
- name: Semantic Release - name: Semantic Release
uses: cycjimmy/semantic-release-action@v6 uses: cycjimmy/semantic-release-action@v3
with: with:
dry_run: true dry_run: true
env: env:
@ -194,33 +189,15 @@ steps:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
``` ```
#### ci
> {Optional Input Parameter} Whether to run semantic release with CI support (default true).<br>`ci` supports for **semantic-release above v16**.
```yaml
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v6
with:
ci: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
```
`ci` can be used, e.g in combination with `dry_run` when generating the next release version in pull requests, where `semantic_release` would normally block the execution.
#### extends #### 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`. 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`.
```yaml ```yaml
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v3
- name: Semantic Release - name: Semantic Release
uses: cycjimmy/semantic-release-action@v6 uses: cycjimmy/semantic-release-action@v3
with: with:
# You can extend an existing shareable configuration. # You can extend an existing shareable configuration.
# And you can specify version range for the shareable configuration if you prefer. # And you can specify version range for the shareable configuration if you prefer.
@ -238,9 +215,9 @@ This action run semantic release in the github provided workspace by default. Yo
```yaml ```yaml
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v3
- name: Semantic Release - name: Semantic Release
uses: cycjimmy/semantic-release-action@v6 uses: cycjimmy/semantic-release-action@v3
with: with:
# You can select another working directory like a subdirectory for example. # You can select another working directory like a subdirectory for example.
working_directory: ./code working_directory: ./code
@ -249,45 +226,6 @@ steps:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
``` ```
#### tag_format
The default tag format on semantic-release is `v{version}`. You can override that behavior using this option (helpful when you are using monorepos)
```yaml
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v6
with:
tag_format: custom-v${version}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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.
```yaml
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Temporarily merge PR branch
if: ${{ github.event_name == 'pull_request' }}
run: |
git config --global user.name github-actions
git config --global user.email github-actions@github.com
git merge --no-ff origin/${{ github.event.pull_request.head.ref }} --message "${{ github.event.pull_request.title }}"
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v6
with:
unset_gha_env: ${{ github.event_name == 'pull_request' }}
ci: ${{ github.event_name == 'pull_request' && false || '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
```
### Outputs ### Outputs
| Output Parameter | Description | | Output Parameter | Description |
|:-------------------------:|-----------------------------------------------------------------------------------------------------------------------------------| |:-------------------------:|-----------------------------------------------------------------------------------------------------------------------------------|
@ -308,9 +246,9 @@ steps:
```yaml ```yaml
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v3
- name: Semantic Release - name: Semantic Release
uses: cycjimmy/semantic-release-action@v6 uses: cycjimmy/semantic-release-action@v3
id: semantic # Need an `id` for output variables id: semantic # Need an `id` for output variables
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -20,24 +20,12 @@ inputs:
dry_run: dry_run:
required: false required: false
description: 'Whether to run semantic release in `dry-run` mode. It will override the dryRun attribute in your configuration file' description: 'Whether to run semantic release in `dry-run` mode. It will override the dryRun attribute in your configuration file'
ci:
required: false
description: 'Whether to run semantic release with CI support (default: true). It will override the ci attribute in your configuration file'
unset_gha_env:
required: false
description: 'Whether to unset the GITHUB_ACTIONS environment variable. This can be useful when trying to run semantic-release as part of PR checks.'
extends: extends:
required: false required: false
description: 'One or several sharable configurations, https://semantic-release.gitbook.io/semantic-release/usage/configuration#extends' description: 'One or several sharable configurations, https://semantic-release.gitbook.io/semantic-release/usage/configuration#extends'
working_directory: working_directory:
required: false required: false
description: 'Specify another working directory for semantic release. Default one is provided by github.' description: 'Specify another working directory for semantic release. Default one is provided by github.'
tag_format:
required: false
description: 'The default tag format on semantic-release is v{version}. You can override that behavior using this option.'
repository_url:
required: false
description: 'The Git repository url. If no repository url specified, current repository will be used by default.'
outputs: outputs:
new_release_published: new_release_published:
description: 'Whether a new release was published' description: 'Whether a new release was published'
@ -64,5 +52,5 @@ outputs:
last_release_git_tag: last_release_git_tag:
description: 'The Git tag associated with the last release, if there was one.' description: 'The Git tag associated with the last release, if there was one.'
runs: runs:
using: 'node24' using: 'node16'
main: 'index.js' main: 'index.js'

View file

@ -1,121 +1,3 @@
# [6.0.0](https://github.com/cycjimmy/semantic-release-action/compare/v5.0.2...v6.0.0) (2025-11-17)
### Features
* **deps:** update semantic-release to version 25 ([9246c0b](https://github.com/cycjimmy/semantic-release-action/commit/9246c0bd17405b1f20450501f39234912258bc50))
### BREAKING CHANGES
* **deps:** Update semantic-release to version 25
## [5.0.2](https://github.com/cycjimmy/semantic-release-action/compare/v5.0.1...v5.0.2) (2025-10-10)
### Bug Fixes
* 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)
## [5.0.1](https://github.com/cycjimmy/semantic-release-action/compare/v5.0.0...v5.0.1) (2025-10-09)
### Bug Fixes
* improves result handling in windUpJob.task.js ([4267eee](https://github.com/cycjimmy/semantic-release-action/commit/4267eee56034cc3ee6f2fef9bdc3cc125ca073db))
# [5.0.0](https://github.com/cycjimmy/semantic-release-action/compare/v4.2.2...v5.0.0) (2025-08-30)
### Features
* update node version on runner to 24 ([7869323](https://github.com/cycjimmy/semantic-release-action/commit/78693238b0cffcbd79484ca9c3f634c6d1e3978a))
### BREAKING CHANGES
* this action now runs using node 24
## [4.2.2](https://github.com/cycjimmy/semantic-release-action/compare/v4.2.1...v4.2.2) (2025-07-04)
### Bug Fixes
* **cleanupNpmrc.task.js:** Use @actions/io to remove .npmrc ([b7db0cb](https://github.com/cycjimmy/semantic-release-action/commit/b7db0cbbf5f42eb8fe027828c236fbc340b5429e))
## [4.2.1](https://github.com/cycjimmy/semantic-release-action/compare/v4.2.0...v4.2.1) (2025-06-07)
### Bug Fixes
* update marked terminal to v7.3.0 ([b52fa1b](https://github.com/cycjimmy/semantic-release-action/commit/b52fa1bae5b892a36c1e01fab61457344cc0c494))
# [4.2.0](https://github.com/cycjimmy/semantic-release-action/compare/v4.1.1...v4.2.0) (2025-03-14)
### Features
* add ability to unset GITHUB_ACTION env var ([266ea7e](https://github.com/cycjimmy/semantic-release-action/commit/266ea7eb8c90943aa9cddd3b0ed326d5e8784a26))
## [4.1.1](https://github.com/cycjimmy/semantic-release-action/compare/v4.1.0...v4.1.1) (2024-09-25)
### Bug Fixes
* default use semantic-release@24 ([c22487b](https://github.com/cycjimmy/semantic-release-action/commit/c22487b442697d88305e0088215bc9da5b07696d))
# [4.1.0](https://github.com/cycjimmy/semantic-release-action/compare/v4.0.0...v4.1.0) (2024-03-19)
### Bug Fixes
* fix syntax error for importing ([4297675](https://github.com/cycjimmy/semantic-release-action/commit/42976755bc1a5e38051e756e3a2344ea8f354379))
### Features
* add repository_url input ([8dffec4](https://github.com/cycjimmy/semantic-release-action/commit/8dffec4efa886f02052787d688bfccb2e9983b1a))
# [4.0.0](https://github.com/cycjimmy/semantic-release-action/compare/v3.4.2...v4.0.0) (2023-08-31)
### Features
* update node version on runner to 20 ([0c20554](https://github.com/cycjimmy/semantic-release-action/commit/0c2055456eeae973aeeb66cf5082061badb3502c))
### BREAKING CHANGES
* set the default node version to 20
## [3.4.2](https://github.com/cycjimmy/semantic-release-action/compare/v3.4.1...v3.4.2) (2023-03-30)
### Bug Fixes
* fix installation error for npm-audit ([86a0e59](https://github.com/cycjimmy/semantic-release-action/commit/86a0e59803808ad228284efb42a130def7974b7c)), closes [#159](https://github.com/cycjimmy/semantic-release-action/issues/159)
## [3.4.1](https://github.com/cycjimmy/semantic-release-action/compare/v3.4.0...v3.4.1) (2023-03-30)
### Bug Fixes
* **windUpJob:** set last_release outputs before returning ([91e3dc6](https://github.com/cycjimmy/semantic-release-action/commit/91e3dc6dcc39e4b462a165d85338c4e6cf1db9b6))
# [3.4.0](https://github.com/cycjimmy/semantic-release-action/compare/v3.3.0...v3.4.0) (2023-03-15)
### Features
* add `ci` input parameter ([b356b18](https://github.com/cycjimmy/semantic-release-action/commit/b356b18b5f474bb4b9fe4bb5801b364ce24aa8f6))
# [3.3.0](https://github.com/cycjimmy/semantic-release-action/compare/v3.2.0...v3.3.0) (2023-03-07)
### Features
* support for option tagFormat ([ed38eb0](https://github.com/cycjimmy/semantic-release-action/commit/ed38eb0e9938eefc792510a75ec48d80fead9b21))
# [3.2.0](https://github.com/cycjimmy/semantic-release-action/compare/v3.1.2...v3.2.0) (2022-11-04) # [3.2.0](https://github.com/cycjimmy/semantic-release-action/compare/v3.1.2...v3.2.0) (2022-11-04)

9852
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{ {
"name": "@cycjimmy/semantic-release-action", "name": "@cycjimmy/semantic-release-action",
"version": "6.0.0", "version": "3.2.0",
"description": "GitHub Action for Semantic Release", "description": "GitHub Action for Semantic Release",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
@ -21,11 +21,10 @@
}, },
"homepage": "https://github.com/cycjimmy/semantic-release-action#readme", "homepage": "https://github.com/cycjimmy/semantic-release-action#readme",
"dependencies": { "dependencies": {
"@actions/core": "^2.0.0", "@actions/core": "^1.10.0",
"@actions/io": "^2.0.0", "@cycjimmy/awesome-js-funcs": "^4.0.4",
"@cycjimmy/awesome-js-funcs": "^4.0.9", "@semantic-release/changelog": "^6.0.1",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1", "@semantic-release/git": "^10.0.1",
"semantic-release": "^25.0.2" "semantic-release": "^19.0.5"
} }
} }

View file

@ -1,9 +1,15 @@
const io = require('@actions/io'); const core = require('@actions/core');
const exec = require('./_exec');
/** /**
* Clean up `.npmrc` file in the repo after releasing * Clean up `.npmrc` file in the repo after releasing
* @returns {Promise<never>} * @returns {Promise<never>}
*/ */
module.exports = async () => { module.exports = async () => {
await io.rmRF('.npmrc'); const {stdout, stderr} = await exec(`rm -f .npmrc`);
core.debug(stdout);
if (stderr) {
return Promise.reject(stderr);
}
}; };

View file

@ -47,7 +47,6 @@ exports.handleBranchesOption = () => {
*/ */
exports.handleDryRunOption = () => { exports.handleDryRunOption = () => {
const dryRun = core.getInput(inputs.dry_run); const dryRun = core.getInput(inputs.dry_run);
core.debug(`dryRun input: ${dryRun}`);
switch (dryRun) { switch (dryRun) {
case 'true': case 'true':
@ -61,33 +60,12 @@ exports.handleDryRunOption = () => {
} }
}; };
/**
* Handle Ci Option
* @returns {{}|{ci: boolean}}
*/
exports.handleCiOption = () => {
const ci = core.getInput(inputs.ci);
core.debug(`ci input: ${ci}`);
switch (ci) {
case 'true':
return { ci: true, noCi: false };
case 'false':
return { ci: false, noCi: true };
default:
return {};
}
};
/** /**
* Handle Extends Option * Handle Extends Option
* @returns {{}|{extends: Array}|{extends: String}} * @returns {{}|{extends: Array}|{extends: String}}
*/ */
exports.handleExtends = () => { exports.handleExtends = () => {
const extend = core.getInput(inputs.extends); const extend = core.getInput(inputs.extends);
core.debug(`extend input: ${extend}`);
if (extend) { if (extend) {
const extendModuleNames = extend.split(/\r?\n/) const extendModuleNames = extend.split(/\r?\n/)
@ -99,35 +77,3 @@ exports.handleExtends = () => {
return {}; return {};
} }
}; };
/**
* Handle TagFormat Option
* @returns {{}|{tagFormat: String}}
*/
exports.handleTagFormat = () => {
const tagFormat = core.getInput(inputs.tag_format);
core.debug(`citagFormat input: ${tagFormat}`);
if (tagFormat) {
return {
tagFormat
};
} else {
return {};
}
};
/**
* Handle repository-url Option
* @returns {{}|{r: String}}
*/
exports.handleRepositoryUrlOption = () => {
const repositoryUrl = core.getInput(inputs.repository_url);
core.debug(`repository_url input: ${repositoryUrl}`);
if (repositoryUrl) {
return { r: repositoryUrl };
} else {
return {};
}
};

View file

@ -2,10 +2,7 @@ const core = require('@actions/core');
const { const {
handleBranchesOption, handleBranchesOption,
handleDryRunOption, handleDryRunOption,
handleCiOption,
handleExtends, handleExtends,
handleTagFormat,
handleRepositoryUrlOption,
} = require('./handleOptions'); } = require('./handleOptions');
const setUpJob = require('./setUpJob.task'); const setUpJob = require('./setUpJob.task');
const installSpecifyingVersionSemantic = require('./installSpecifyingVersionSemantic.task'); const installSpecifyingVersionSemantic = require('./installSpecifyingVersionSemantic.task');
@ -27,19 +24,11 @@ const release = async () => {
await preInstall(core.getInput(inputs.extra_plugins)); await preInstall(core.getInput(inputs.extra_plugins));
await preInstall(core.getInput(inputs.extends)); await preInstall(core.getInput(inputs.extends));
if (core.getInput(inputs.unset_gha_env) === 'true') { const semanticRelease = require('semantic-release');
core.debug('Unset GITHUB_ACTIONS environment variable'); const result = await semanticRelease({
delete process.env.GITHUB_ACTIONS;
}
const semanticRelease = await import('semantic-release');
const result = await semanticRelease.default({
...handleBranchesOption(), ...handleBranchesOption(),
...handleDryRunOption(), ...handleDryRunOption(),
...handleCiOption(),
...handleExtends(), ...handleExtends(),
...handleTagFormat(),
...handleRepositoryUrlOption()
}); });
await cleanupNpmrc(); await cleanupNpmrc();

View file

@ -4,10 +4,6 @@
"branch": "branch", "branch": "branch",
"extra_plugins": "extra_plugins", "extra_plugins": "extra_plugins",
"dry_run": "dry_run", "dry_run": "dry_run",
"ci": "ci",
"unset_gha_env": "unset_gha_env",
"extends": "extends", "extends": "extends",
"working_directory": "working_directory", "working_directory": "working_directory"
"tag_format": "tag_format",
"repository_url": "repository_url"
} }

View file

@ -13,7 +13,7 @@ module.exports = async () => {
? `@${semantic_version}` ? `@${semantic_version}`
: ''; : '';
const {stdout, stderr} = await exec(`npm install semantic-release${versionSuffix} --no-audit --silent`, { const {stdout, stderr} = await exec(`npm install semantic-release${versionSuffix} --silent`, {
cwd: path.resolve(__dirname, '..') cwd: path.resolve(__dirname, '..')
}); });
core.debug(stdout); core.debug(stdout);

View file

@ -12,9 +12,8 @@ module.exports = async extras => {
} }
const _extras = extras.replace(/['"]/g, '').replace(/[\n\r]/g, ' '); const _extras = extras.replace(/['"]/g, '').replace(/[\n\r]/g, ' ');
const silentFlag = process.env.RUNNER_DEBUG === '1' ? '' : '--silent';
const { stdout, stderr } = await exec(`npm install ${_extras} --no-audit ${silentFlag}`, { const { stdout, stderr } = await exec(`npm install ${_extras} --silent`, {
cwd: path.resolve(__dirname, '..') cwd: path.resolve(__dirname, '..')
}); });
core.debug(stdout); core.debug(stdout);

View file

@ -7,29 +7,21 @@ const outputs = require('./outputs.json');
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
module.exports = async (result) => { module.exports = async (result) => {
const resolved = await result; if (!result) {
if (!resolved) {
core.debug('No release published.'); core.debug('No release published.');
return; return Promise.resolve();
} }
const { const {lastRelease, commits, nextRelease, releases} = result;
lastRelease = {},
commits = [],
nextRelease = {},
releases = [],
} = resolved;
if (lastRelease?.version) { if (lastRelease.version) {
core.debug(`The last release was "${lastRelease.version}".`); core.debug(`The last release was "${lastRelease.version}".`);
core.setOutput(outputs.last_release_version, lastRelease.version); core.setOutput(outputs.last_release_version, lastRelease.version)
core.setOutput(outputs.last_release_git_head, lastRelease.gitHead);
core.setOutput(outputs.last_release_git_tag, lastRelease.gitTag);
} }
if (!nextRelease?.version) { if (!nextRelease) {
core.debug('No release published.'); core.debug('No release published.');
return; return Promise.resolve();
} }
core.debug(`Published ${nextRelease.type} release version ${nextRelease.version} containing ${commits.length} commits.`); core.debug(`Published ${nextRelease.type} release version ${nextRelease.version} containing ${commits.length} commits.`);
@ -51,4 +43,7 @@ module.exports = async (result) => {
core.setOutput(outputs.new_release_notes, notes); core.setOutput(outputs.new_release_notes, notes);
core.setOutput(outputs.new_release_git_head, gitHead); core.setOutput(outputs.new_release_git_head, gitHead);
core.setOutput(outputs.new_release_git_tag, gitTag); core.setOutput(outputs.new_release_git_tag, gitTag);
core.setOutput(outputs.last_release_version, lastRelease.version);
core.setOutput(outputs.last_release_git_head, lastRelease.gitHead);
core.setOutput(outputs.last_release_git_tag, lastRelease.gitTag);
}; };