From f6f4ec55ae3567f5578e4f248348bcb4c6fb1227 Mon Sep 17 00:00:00 2001 From: Grzegorz Kowalik Date: Wed, 30 Dec 2020 11:06:26 +0100 Subject: [PATCH] Deploy to staging after merge to master --- .github/workflows/deploy-staging.yaml | 42 +++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/deploy-staging.yaml diff --git a/.github/workflows/deploy-staging.yaml b/.github/workflows/deploy-staging.yaml new file mode 100644 index 000000000..20b90e74c --- /dev/null +++ b/.github/workflows/deploy-staging.yaml @@ -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*" \ No newline at end of file