Deploy Cobudget UI #89
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Cobudget UI | |
on: | |
watch: | |
types: [started] | |
push: | |
branches: | |
- develop | |
- master | |
paths-ignore: | |
- 'api/**' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: build | |
uses: actions/checkout@v2 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: '8' | |
- run: | | |
cd ui | |
npm install --silent | |
- name: deploy staging | |
if: github.ref == 'refs/heads/develop' | |
run: | | |
cd ui || find . | |
npm run build | |
npm run sentry | |
aws s3 sync ./build/ s3://${AWS_S3_BUCKET}/ --acl public-read --cache-control max-age=86400 --delete | |
aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths "/*" | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_STAGING_BUCKET_NAME }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
DISTRIBUTION_ID: ${{ secrets.STAGING_DISTRIBUTION_ID }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
APP_ENV: staging | |
NODE_ENV: production | |
- name: deploy production | |
if: github.ref == 'refs/heads/master' | |
run: | | |
cd ui || find . | |
npm run build | |
npm run sentry | |
aws s3 sync ./build/ s3://${AWS_S3_BUCKET}/ --acl public-read --cache-control max-age=86400 --delete | |
aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths "/*" | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_PRODUCTION_BUCKET_NAME }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
DISTRIBUTION_ID: ${{ secrets.DISTRIBUTION_ID }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
APP_ENV: production | |
NODE_ENV: production |