Change cloud deployment trigger to repository_dispatch (#1455)
* Change cloud deployment trigger to repository_dispatch * Refactor staging deployments
This commit is contained in:
parent
d21e688f7d
commit
d03bf9c791
4 changed files with 113 additions and 38 deletions
|
@ -1,16 +1,7 @@
|
|||
name: Deploy to production
|
||||
name: Deploy to cloud
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
service_name:
|
||||
description: Name of the service
|
||||
required: true
|
||||
region:
|
||||
description: Region to which deploy (eu or us)
|
||||
required: true
|
||||
git_ref:
|
||||
description: Git ref (tag, branch or full commit hash) to deploy
|
||||
required: true
|
||||
repository_dispatch:
|
||||
types: cloud-deployment
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
@ -22,19 +13,20 @@ jobs:
|
|||
SENTRY_ORG: saleor
|
||||
SENTRY_PROJECT: dashboard
|
||||
SENTRY_URL_PREFIX: "~/dashboard/static"
|
||||
ENVIRONMENT: ${{ github.event.inputs.service_name }}
|
||||
ENVIRONMENT: ${{ github.event.client_payload.deployment_name }}
|
||||
REGION: ${{ github.event.client_payload.region }}
|
||||
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.inputs.git_ref }}
|
||||
ref: ${{ github.event.client_payload.ref }}
|
||||
- name: Package
|
||||
timeout-minutes: 15
|
||||
run: |
|
||||
npm ci
|
||||
- name: build
|
||||
- name: Build
|
||||
run: |
|
||||
npm run build
|
||||
- name: Configure AWS Credentials
|
||||
|
@ -45,7 +37,6 @@ jobs:
|
|||
aws-region: us-east-1
|
||||
- name: Deploy
|
||||
run: |
|
||||
REGION=${{ github.event.inputs.region }}
|
||||
if [[ "$REGION" == "us" ]]; then
|
||||
BUCKET=${{ secrets.AWS_PROD_US_DEPLOYMENT_BUCKET }}
|
||||
CF_ID=${{ secrets.AWS_PROD_US_CF_DIST_ID }}
|
|
@ -1,17 +1,14 @@
|
|||
name: Deploy to staging
|
||||
name: Deploy Dashboard 3.1 to latest staging
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- ci/staging/**
|
||||
tags:
|
||||
- 3.1**
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
git_ref:
|
||||
description: Git ref (tag, branch or commit hash) with helm chart to deploy
|
||||
required: true
|
||||
service_name:
|
||||
description: Name of the service
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-20.04
|
||||
|
@ -24,38 +21,29 @@ jobs:
|
|||
SENTRY_URL_PREFIX: "~/dashboard/static"
|
||||
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||
ENVIRONMENT: saleor-latest-staging
|
||||
IS_CLOUD_INSTANCE: true
|
||||
steps:
|
||||
- name: Set env variables
|
||||
run: |
|
||||
set -x
|
||||
|
||||
GIT_REF_INPUT=${{ github.event.inputs.git_ref }}
|
||||
GIT_REF="${GIT_REF_INPUT:=master}"
|
||||
|
||||
SERVICE_NAME_INPUT=${{ github.event.inputs.service_name }}
|
||||
SERVICE_NAME="${SERVICE_NAME_INPUT:=saleor-master-staging}"
|
||||
|
||||
echo "GIT_REF=$GIT_REF" >> $GITHUB_ENV
|
||||
# ENVIRONMENT variable is provided to sentry at build time
|
||||
echo "ENVIRONMENT=$SERVICE_NAME" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: ${{ env.GIT_REF }}
|
||||
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_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 }}/${ENVIRONMENT}/static/
|
45
.github/workflows/deploy-master-staging.yaml
vendored
Normal file
45
.github/workflows/deploy-master-staging.yaml
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
name: Deploy Dashboard to master staging
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- ci/staging/**
|
||||
workflow_dispatch:
|
||||
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: saleor-master-staging
|
||||
IS_CLOUD_INSTANCE: true
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- 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_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 }}/${ENVIRONMENT}/static/
|
||||
aws s3 cp build/dashboard/index.html s3://${{ secrets.AWS_STAGING_DEPLOYMENT_BUCKET }}/${ENVIRONMENT}/
|
||||
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_STAGING_CF_DIST_ID }} --paths "/dashboard*"
|
51
.github/workflows/deploy-stable-staging.yaml
vendored
Normal file
51
.github/workflows/deploy-stable-staging.yaml
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
name: Deploy Dashboard 3.0 to stable staging
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 3.0**
|
||||
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: saleor-stable-staging
|
||||
IS_CLOUD_INSTANCE: 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_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 }}/${ENVIRONMENT}/static/
|
||||
aws s3 cp build/dashboard/index.html s3://${{ secrets.AWS_STAGING_DEPLOYMENT_BUCKET }}/${ENVIRONMENT}/
|
||||
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_STAGING_CF_DIST_ID }} --paths "/dashboard*"
|
Loading…
Reference in a new issue