Files
redocly-cli/scripts/archive-and-upload-bundle.js
Sergey Dubovyk f3d8cb61ad chore: upload to AWS S3 for each version tag (#178)
* chore: add deployment action

* chore: add secrets

* chore: trigger build

* chore: add try/catch and rename profile arg

* chore: trigger deployment on tag with version

* chore: remove deployment from prebublish script

* fix: regexp

* fix: glob instead of regexp on tag

* chore: add caching of node_modules for bundling
2020-08-14 11:45:26 +03:00

30 lines
741 B
JavaScript

const yargs = require('yargs');
const { execSync } = require('child_process');
const package = require('../package.json');
const version = package.version;
const fileName = `openapi-cli.${version}.tar.gz`;
const fileNameLatest = `openapi-cli.latest.tar.gz`;
execSync(`tar -zcvf ${fileName} dist`);
execSync(`tar -zcvf ${fileNameLatest} dist`);
const argv = yargs
.option('aws-profile', {
alias: 'p',
type: 'string',
})
.argv;
let profile = !!argv.awsProfile ? `--profile ${argv.awsProfile}` : '';
try {
execSync(`aws s3 cp ${fileName} s3://openapi-cli-dist ${profile}`);
execSync(`aws s3 cp ${fileNameLatest} s3://openapi-cli-dist ${profile}`);
} catch (e) {
process.stderr.write(e.output);
}