Add demo staging deployment workflow (#2042)
This commit is contained in:
parent
4c24d01d7a
commit
9cf555d740
1 changed files with 69 additions and 0 deletions
69
.github/workflows/deploy-demo-staging.yaml
vendored
Normal file
69
.github/workflows/deploy-demo-staging.yaml
vendored
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
name: Deploy to staging demo
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 3.3**
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
git_ref:
|
||||||
|
description: Git ref (tag, branch or commit hash) with helm chart to deploy
|
||||||
|
required: true
|
||||||
|
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"
|
||||||
|
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
||||||
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||||
|
ENVIRONMENT: demo-staging
|
||||||
|
DEMO_MODE: true
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.inputs.git_ref || '' }}
|
||||||
|
- name: Package
|
||||||
|
timeout-minutes: 15
|
||||||
|
run: |
|
||||||
|
npm ci
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
npm run build
|
||||||
|
- name: Configure AWS Credentials
|
||||||
|
uses: aws-actions/configure-aws-credentials@v1
|
||||||
|
with:
|
||||||
|
aws-access-key-id: ${{ secrets.AWS_DASHBOARD_STAGING_ACCESS_KEY_ID }}
|
||||||
|
aws-secret-access-key: ${{ secrets.AWS_DASHBOARD_STAGING_SECRET_ACCESS_KEY }}
|
||||||
|
aws-region: us-east-1
|
||||||
|
- name: Deploy
|
||||||
|
run: |
|
||||||
|
aws s3 sync build/dashboard s3://${{ secrets.AWS_DEMO_STAGING_DEPLOYMENT_BUCKET }}/dashboard/static/
|
||||||
|
aws s3 cp build/dashboard/index.html s3://${{ secrets.AWS_DEMO_STAGING_DEPLOYMENT_BUCKET }}/dashboard/
|
||||||
|
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_DEMO_STAGING_CF_DIST_ID }} --paths "/dashboard*"
|
||||||
|
- name: Prepare Demo release pull request
|
||||||
|
run: |
|
||||||
|
export GITHUB_TOKEN=$( \
|
||||||
|
curl --request GET --url ${{ secrets.VAULT_URL}} --header "Authorization: JWT ${{ secrets.VAULT_JWT }}" | jq -r .token \
|
||||||
|
)
|
||||||
|
gh api /repos/saleor/saleor-cloud-deployments/dispatches \
|
||||||
|
--input - <<< '{
|
||||||
|
"event_type": "open-release-pull-request",
|
||||||
|
"client_payload": {
|
||||||
|
"project": "DASHBOARD",
|
||||||
|
"environment": "DEMO",
|
||||||
|
"version": "${{ github.event.inputs.git_ref || github.ref_name }}"
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
- 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
|
Loading…
Reference in a new issue