diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..baccc08 --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,13 @@ +name: Publish package + +on: + release: + types: [created] + +jobs: + publish-npm: + uses: cabify/javascript-actions/.github/workflows/npm_publish.yml@main + with: + tag: ${{ contains(github.ref_name,'beta') && 'beta' || 'latest' }} + secrets: + token: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..ea5e4da --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,7 @@ +name: Tests + +on: [push] + +jobs: + test: + uses: cabify/javascript-actions/.github/workflows/tests.yml@main diff --git a/scripts/prepublish.js b/scripts/prepublish.js index c99db91..38933a7 100644 --- a/scripts/prepublish.js +++ b/scripts/prepublish.js @@ -1,15 +1,14 @@ /* eslint-disable no-console */ /* eslint-disable no-undef */ -require('shelljs/global'); +require("shelljs/global"); -console.info('--- PREPUBLISH ...'); -const noError = result => result.code === 0; +console.info("--- PREPUBLISH ..."); +const noError = (result) => result.code === 0; -const execOrDie = (cmd, text) => (noError(exec(cmd)) ? console.info(text) : exit(-1)); +const execOrDie = (cmd, text) => + noError(exec(cmd)) ? console.info(text) : exit(-1); -execOrDie('npm run -s clean', '--- Clean OK ---'); -execOrDie('npm run -s build', '--- Build OK ---'); -execOrDie('npm run -s test', '--- Tests OK ---'); -execOrDie('npm run -s lint', '--- Lint OK ---'); -execOrDie('cp ./src/types.d.ts ./dist/types.d.ts', '--- Copied types OK ---'); -echo('... Prepublish OK ---'); +execOrDie("npm run -s build", "--- Build OK ---"); + +execOrDie("cp ./src/types.d.ts ./dist/types.d.ts", "--- Copied types OK ---"); +echo("... Prepublish OK ---");