From af36ad39af0ad614b15078042b0b191fa645b5d8 Mon Sep 17 00:00:00 2001 From: Andriy Leliv Date: Wed, 2 Sep 2020 15:40:26 +0300 Subject: [PATCH] feat: demo deployment to s3 --- .github/workflows/demo-deploy-s3.yml | 30 ++++++++++++++++++++++++++++ .gitignore | 1 + package.json | 2 +- 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/demo-deploy-s3.yml diff --git a/.github/workflows/demo-deploy-s3.yml b/.github/workflows/demo-deploy-s3.yml new file mode 100644 index 00000000..0696cbca --- /dev/null +++ b/.github/workflows/demo-deploy-s3.yml @@ -0,0 +1,30 @@ +name: Redoc demo CI/CD + +on: + push: + tags: + - v[0-9]*.[0-9]*.[0-9]* + +defaults: + run: + working-directory: demo + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-1 + - name: Install dependencies + run: npm install + - name: Build package + run: npm run build:demo + - name: Deploy to S3 bucket + run: npm run deploy:demo + - name: Invalidate + run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CF_DEMO_DISTRIBUTION_ID }} --paths "/*" diff --git a/.gitignore b/.gitignore index 799396e5..fa07d0df 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ cli/index.js .ghpages-tmp stats.json yarn.lock +.idea diff --git a/package.json b/package.json index 6e4744f1..c6cac050 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "start:demo": "webpack-dev-server --hot --config demo/webpack.config.ts --mode=development", "compile:cli": "tsc custom.d.ts cli/index.ts --target es6 --module commonjs --types yargs", "build:demo": "webpack --mode=production --config demo/webpack.config.ts", - "deploy:demo": "npm run build:demo && deploy-to-gh-pages --update demo/dist", + "deploy:demo": "aws s3 sync demo/dist s3://production-redoc-demo --acl=public-read", "license-check": "license-checker --production --onlyAllow 'MIT;ISC;Apache-2.0;BSD;BSD-2-Clause;BSD-3-Clause' --summary", "docker:build": "docker build -f config/docker/Dockerfile -t redoc ." },