diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3e25300..3433aaf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -184,6 +184,26 @@ jobs: version-file: 'test-file.yaml' version-path: 'package.version' + - name: Generate changelog + uses: ./ + env: + ENV: 'dont-use-git' + EXPECTED_TAG: 'v9.6.0' + with: + github-token: ${{ secrets.github_token }} + version-file: 'test-file.yaml' + version-path: 'package.no-quotes-version' + + - name: Generate changelog + uses: ./ + env: + ENV: 'dont-use-git' + EXPECTED_TAG: 'v9.7.0' + with: + github-token: ${{ secrets.github_token }} + version-file: 'test-file.yaml' + version-path: 'package.double-quotes-version' + - name: Show file run: | echo "$( { - return fs.existsSync(this.fileLocation) ? fs.readFileSync(this.fileLocation, 'utf8') : '' + if (fs.existsSync(this.fileLocation)) { + return fs.readFileSync(this.fileLocation, 'utf8') + } + + core.warning(`Tried to read "${this.fileLocation}" but file does not exist!`) + + return '' } /** diff --git a/src/version/json.js b/src/version/json.js index 4f75ba0..88f34f0 100644 --- a/src/version/json.js +++ b/src/version/json.js @@ -38,6 +38,8 @@ module.exports = new (class Json extends BaseVersioning { oldVersion, ) + core.info(`Bumped file "${this.fileLocation}" from "${oldVersion}" to "${this.newVersion}"`) + // Update the content with the new version objectPath.set(jsonContent, this.versionPath, this.newVersion) diff --git a/src/version/toml.js b/src/version/toml.js index 33ce04d..ce08a66 100644 --- a/src/version/toml.js +++ b/src/version/toml.js @@ -1,3 +1,4 @@ +const core = require('@actions/core') const objectPath = require('object-path') const toml = require('@iarna/toml') @@ -29,6 +30,8 @@ module.exports = new (class Toml extends BaseVersioning { // Get the name of where the version is in const versionName = this.versionPath.split('.').pop() + core.info(`Bumped file "${this.fileLocation}" from "${oldVersion}" to "${this.newVersion}"`) + this.update( // We use replace instead of yaml.stringify so we can preserve white spaces and comments fileContent.replace( diff --git a/test-file.toml b/test-file.toml index 468a5b2..b912622 100644 --- a/test-file.toml +++ b/test-file.toml @@ -1,4 +1,5 @@ title = "test" +version = "1.4.5" # Comment [package]