From e63e00c563bd7191db28f0e8c5308adc2bd840c6 Mon Sep 17 00:00:00 2001 From: Patrick Dreker Date: Wed, 23 Nov 2022 10:13:36 +0100 Subject: [PATCH] fix: honour pre-release flag for default version if there is no previous version and no explicit fallback version is specified emit a pre-release version (0.1.0-rc.0 by default) if the pre-release flag is true. --- README.md | 2 +- src/helpers/bumpVersion.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index df5b69e..a4e584b 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ This action will bump version, tag commit and generate a changelog with conventi - **Optional** `skip-version-file`: Do not update the version file. Default `'false'`. - **Optional** `skip-commit`: Do not create a release commit. Default `'false'`. - **Optional** `pre-commit`: Path to the pre-commit script file. No hook by default. -- **Optional** `fallback-version`: The fallback version, if no older one can be detected, or if it is the first one. Default `'0.1.0'` +- **Optional** `fallback-version`: The fallback version, if no older one can be detected, or if it is the first one. Default `'0.1.0'`. If `pre-release`is set to `true` it will default to the configured pre-release format (i.e. `'0.1.0-rc.0'`) - **Optional** `config-file-path`: Path to the conventional changelog config file. If set, the preset setting will be ignored - **Optional** `pre-changelog-generation`: Path to the pre-changelog-generation script file. No hook by default. - **Optional** `skip-ci`: Adds instruction to Github to not consider the push something to rebuild. Default `true`. diff --git a/src/helpers/bumpVersion.js b/src/helpers/bumpVersion.js index 3155303..fb78487 100644 --- a/src/helpers/bumpVersion.js +++ b/src/helpers/bumpVersion.js @@ -25,7 +25,7 @@ module.exports = async (releaseType, version) => { newVersion = version } else { // default - newVersion = '0.1.0' + newVersion = (prerelease ? `0.1.0-${identifier}.0` : '0.1.0') } core.info(`The version could not be detected, using fallback version '${newVersion}'.`)