Skip to content

Commit

Permalink
Added Github actions configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandrofdiaz committed Aug 28, 2023
1 parent 66ec3c2 commit 5ffc3cb
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -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 }}
7 changes: 7 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: Tests

on: [push]

jobs:
test:
uses: cabify/javascript-actions/.github/workflows/tests.yml@main
19 changes: 9 additions & 10 deletions scripts/prepublish.js
Original file line number Diff line number Diff line change
@@ -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 ---");

0 comments on commit 5ffc3cb

Please sign in to comment.