Skip to content

Commit

Permalink
Disallow publishing prerelease as action
Browse files Browse the repository at this point in the history
  • Loading branch information
ghengeveld committed May 21, 2021
1 parent ab2303a commit a85958b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scripts/publish-action.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
const cpy = require('cpy');
const execa = require('execa');
const { readJSON } = require('fs-extra');
const { join } = require('path');
const tmp = require('tmp-promise');

(async () => {
const { version } = await readJSON(join(__dirname, '../package.json'));
if (!/^[0-9]+\.[0-9]+\.[0-9]+$/.test(version)) {
// eslint-disable-next-line no-console
console.warn(`Not publishing action for ${version} because it's a prerelease`);
return;
}

const { path, cleanup } = await tmp.dir({ unsafeCleanup: true, prefix: `chromatic-action-` });
const run = (cmd, opts) => execa.command(cmd, { cwd: path, stdio: 'inherit', ...opts });

Expand Down

0 comments on commit a85958b

Please sign in to comment.