Deploy to staging after merge to master

This commit is contained in:
Grzegorz Kowalik 2020-12-30 11:06:26 +01:00
parent 71b4b329d8
commit f6f4ec55ae

42
.github/workflows/deploy-staging.yaml vendored Normal file
View file

@ -0,0 +1,42 @@
name: Deploy to staging
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-20.04
env:
API_URI: https://master.staging.saleor.cloud/graphql
APP_MOUNT_URI: /dashboard/
STATIC_URL: /dashboard/static/
steps:
- uses: actions/checkout@v2
- name: Package
run: |
npm ci
npm run build
- uses: actions/upload-artifact@v2
with:
name: build
path: build
deploy:
needs:
- build
runs-on: ubuntu-20.04
steps:
- uses: actions/download-artifact@v2
with:
name: build
path: build
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_STAGING_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_STAGING_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Deploy
run: |
aws s3 sync build/dashboard s3://${{ secrets.AWS_STAGING_DEPLOYMENT_BUCKET }}/saleor-master-staging/static/
aws s3 cp build/dashboard/index.html s3://${{ secrets.AWS_STAGING_DEPLOYMENT_BUCKET }}/saleor-master-staging/
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_STAGING_CF_DIST_ID }} --paths "/dashboard*"