diff --git a/.github/actions/bumpVersion/bumpVersion.js b/.github/actions/bumpVersion/bumpVersion.js index 11b56eb24f73..ad4d34e75a73 100644 --- a/.github/actions/bumpVersion/bumpVersion.js +++ b/.github/actions/bumpVersion/bumpVersion.js @@ -48,10 +48,18 @@ do { // tags come from latest to oldest const highestVersion = tags[0]; - console.log(highestVersion); + console.log(`Highest version found: ${highestVersion}.`); - // should SEMVER_LEVEL default to BUILD? - const semanticVersionLevel = core.getInput('SEMVER_LEVEL', {require: true}); + let semanticVersionLevel = core.getInput('SEMVER_LEVEL', {require: true}); + + // SEMVER_LEVEL defaults to BUILD + // it actually would fall to build anyway, but I think it is better to make it explicity + if (!semanticVersionLevel || !Object.values(functions.semanticVersionLevels) + .find(v => v === semanticVersionLevel)) { + // eslint-disable-next-line max-len, semi + console.log(`Invalid input for 'SEMVER_LEVEL': ${semanticVersionLevel},defaulting to: ${functions.semanticVersionLevels.build}`) + semanticVersionLevel = functions.semanticVersionLevels.build; + } const newVersion = functions.incrementVersion(highestVersion, semanticVersionLevel); core.setOutput('VERSION', newVersion); diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index ee77b3e51003..5f8ddd5d7275 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -37,7 +37,7 @@ jobs: uses: ./.github/actions/bumpVersion with: GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }} - SEMVER_LEVEL: Patch + SEMVER_LEVEL: PATCH - name: Print new version run: echo "New version is ${{steps.generate-new-version.outputs.VERSION}}"