Deploy to GCP (#2327)

This commit is contained in:
Tomasz Magulski 2022-09-27 13:51:27 +02:00 committed by GitHub
parent 6738467304
commit 781eafa68e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

51
.github/workflows/deploy-gcp.yml vendored Normal file
View file

@ -0,0 +1,51 @@
name: Deploy to GCP
on:
repository_dispatch:
types: gcp-deployment
jobs:
build:
runs-on: ubuntu-20.04
env:
API_URI: /graphql/
APP_MOUNT_URI: /dashboard/
STATIC_URL: /dashboard/static/
SENTRY_ORG: saleor
SENTRY_PROJECT: dashboard
SENTRY_URL_PREFIX: "~/dashboard/static"
ENVIRONMENT: ${{ github.event.client_payload.deployment_name }}
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
IS_CLOUD_INSTANCE: true
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.client_payload.ref }}
- name: Package
timeout-minutes: 15
run: |
npm ci
- name: Build
run: |
npm run build
- uses: google-github-actions/auth@v0
with:
credentials_json: ${{ secrets.GCP_DASHBOARD_PROD_PRIVATE_KEY }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v0
- name: Deploy
run: |
gcloud storage cp -r build/dashboard/* gs://saleor-cloud-eu-dashboard/${ENVIRONMENT}/static/
gcloud storage cp build/dashboard/index.html gs://saleor-cloud-eu-dashboard/${ENVIRONMENT}/index.html
gcloud compute url-maps invalidate-cdn-cache saleor-cloud-eu --path "/dashboard" --async
gcloud compute url-maps invalidate-cdn-cache saleor-cloud-eu --path "/dashboard/*" --async
- name: Notify Slack
if: ${{ always() }}
env:
JOB_DEPLOYMENT_KIND: production
JOB_STATUS: ${{ job.status }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CLOUD_DEPLOYMENTS_WEBHOOK_URL }}
JOB_TITLE: "Dashboard deployment to ${{ env.ENVIRONMENT }}"
run: |
python3 ./.github/workflows/notify/notify-slack.py