diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 60fa5b1..fcbc84a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -26,7 +26,7 @@ jobs: - name: Get Package Version id: package-version - run: node -p "require('./utils').actionVersion()" >> $GITHUB_OUTPUT + run: node -p "version=${require('./package').version}" >> $GITHUB_OUTPUT # - name: Publish # run: | diff --git a/README.md b/README.md index 20897a0..cb2e08a 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ JavaScript helpers for Node.js addon development. The short list of helpers: 'install', 'cpbin', 'download', 'read', 'write', 'copy', 'exists', 'mkdir', 'stat', 'isDir', 'isFile', 'dirUp', 'ensuredir', 'copysafe', 'readdir', 'subdirs', 'subfiles', 'traverse', 'copyall', - 'rmdir', 'rm', 'WritableBuffer', 'actionVersion', 'actionZip', + 'rmdir', 'rm', 'WritableBuffer', 'actionZip', ``` diff --git a/index.d.ts b/index.d.ts index fc86c78..578b062 100644 --- a/index.d.ts +++ b/index.d.ts @@ -77,23 +77,6 @@ declare module "addon-tools-raub" { export const cpbin: (name: string) => Promise; - /** - * Package version for GitHub Actions - * Example of `actionVersion` usage in **Github Actions**: - * - * ``` - * - name: Get Package Version - * id: package-version - * run: node -p "require('addon-tools-raub').actionVersion()" >> $GITHUB_OUTPUT - * - name: Create Release - * uses: softprops/action-gh-release@v1 - * with: - * tag_name: ${{ steps.package-version.outputs.version }} - * ``` - */ - export const actionVersion: () => void; - - /** * Package version for GitHub Actions * Example of `actionZip` usage in **Github Actions**: diff --git a/utils/action-version.js b/utils/action-version.js deleted file mode 100644 index ad3a3f4..0000000 --- a/utils/action-version.js +++ /dev/null @@ -1,6 +0,0 @@ -'use strict'; - - -module.exports = { - actionVersion: () => `version=${process.env.npm_package_version}`, -}; diff --git a/utils/index.js b/utils/index.js index 0497cdb..8051af5 100644 --- a/utils/index.js +++ b/utils/index.js @@ -2,7 +2,6 @@ module.exports = { - ...require('./action-version'), ...require('./action-zip'), ...require('./cpbin'), ...require('./download'), diff --git a/utils/utils.test.js b/utils/utils.test.js index 2289a71..14159dc 100644 --- a/utils/utils.test.js +++ b/utils/utils.test.js @@ -1,10 +1,6 @@ 'use strict'; -const util = require('node:util'); -const exec = util.promisify(require('node:child_process').exec); - const utils = require('.'); -const packageJson = require('../package.json'); describe('AT / utils', () => { @@ -12,7 +8,7 @@ describe('AT / utils', () => { 'install', 'cpbin', 'download', 'read', 'write', 'copy', 'exists', 'mkdir', 'stat', 'isDir', 'isFile', 'dirUp', 'ensuredir', 'copysafe', 'readdir', 'subdirs', 'subfiles', 'traverse', 'copyall', - 'rmdir', 'rm', 'WritableBuffer', 'actionVersion', 'actionZip', + 'rmdir', 'rm', 'WritableBuffer', 'actionZip', ]; methods.forEach((name) => { @@ -20,11 +16,4 @@ describe('AT / utils', () => { expect(typeof utils[name]).toBe('function'); }); }); - - describe('actionVersion', () => { - it('logs package version', async () => { - const { stdout } = await exec('node -p "require(\'./utils\').actionVersion()"'); - expect(stdout).toBe(`version=${packageJson.version}\n`); - }); - }); });