mirror of
https://github.com/LukeHagar/redocly-cli.git
synced 2025-12-06 04:21:09 +00:00
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
This commit is contained in:
36
.github/workflows/deploy.yaml
vendored
Normal file
36
.github/workflows/deploy.yaml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
name: Deploy to Workflows
|
||||
|
||||
on:
|
||||
tag:
|
||||
- v[0-9]*.[0-9]*.[0-9]*
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: cache node modules
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
|
||||
key: npm-${{ hashFiles('package-lock.json') }}
|
||||
restore-keys: |
|
||||
npm-${{ hashFiles('package-lock.json') }}
|
||||
npm-
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Build package
|
||||
run: npm run build
|
||||
|
||||
- name: Bundle into single file
|
||||
run: npm run bundle
|
||||
|
||||
- name: Upload to AWS S3 bucket
|
||||
run: npm run upload
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
AWS_DEFAULT_REGION: us-east-1
|
||||
@@ -12,7 +12,7 @@
|
||||
"benchmark": "node --expose-gc --noconcurrent_sweeping --predictable ./benchmark/benchmark.js",
|
||||
"prettier": "npx prettier --write \"**/*.{ts,js}\"",
|
||||
"typecheck": "tsc --noEmit --skipLibCheck",
|
||||
"prepublishOnly": "npm run build && npm run bundle && npm run upload",
|
||||
"prepublishOnly": "npm run build",
|
||||
"bundle": "webpack --config webpack.config.ts",
|
||||
"upload": "node scripts/archive-and-upload-bundle.js"
|
||||
},
|
||||
|
||||
@@ -12,13 +12,18 @@ execSync(`tar -zcvf ${fileNameLatest} dist`);
|
||||
|
||||
|
||||
const argv = yargs
|
||||
.option('aws_profile', {
|
||||
.option('aws-profile', {
|
||||
alias: 'p',
|
||||
type: 'string',
|
||||
})
|
||||
.argv;
|
||||
|
||||
let profile = !!argv.aws_profile ? `--profile ${argv.aws_profile}` : '';
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user