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:
|
on:
|
||||||
workflow_dispatch:
|
repository_dispatch:
|
||||||
inputs:
|
types: cloud-deployment
|
||||||
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
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
@ -22,19 +13,20 @@ jobs:
|
||||||
SENTRY_ORG: saleor
|
SENTRY_ORG: saleor
|
||||||
SENTRY_PROJECT: dashboard
|
SENTRY_PROJECT: dashboard
|
||||||
SENTRY_URL_PREFIX: "~/dashboard/static"
|
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_DSN: ${{ secrets.SENTRY_DSN }}
|
||||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||||
IS_CLOUD_INSTANCE: true
|
IS_CLOUD_INSTANCE: true
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.event.inputs.git_ref }}
|
ref: ${{ github.event.client_payload.ref }}
|
||||||
- name: Package
|
- name: Package
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
run: |
|
run: |
|
||||||
npm ci
|
npm ci
|
||||||
- name: build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
npm run build
|
npm run build
|
||||||
- name: Configure AWS Credentials
|
- name: Configure AWS Credentials
|
||||||
|
@ -45,7 +37,6 @@ jobs:
|
||||||
aws-region: us-east-1
|
aws-region: us-east-1
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
run: |
|
run: |
|
||||||
REGION=${{ github.event.inputs.region }}
|
|
||||||
if [[ "$REGION" == "us" ]]; then
|
if [[ "$REGION" == "us" ]]; then
|
||||||
BUCKET=${{ secrets.AWS_PROD_US_DEPLOYMENT_BUCKET }}
|
BUCKET=${{ secrets.AWS_PROD_US_DEPLOYMENT_BUCKET }}
|
||||||
CF_ID=${{ secrets.AWS_PROD_US_CF_DIST_ID }}
|
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:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
tags:
|
||||||
- master
|
- 3.1**
|
||||||
- ci/staging/**
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
git_ref:
|
git_ref:
|
||||||
description: Git ref (tag, branch or commit hash) with helm chart to deploy
|
description: Git ref (tag, branch or commit hash) with helm chart to deploy
|
||||||
required: true
|
required: true
|
||||||
service_name:
|
|
||||||
description: Name of the service
|
|
||||||
required: true
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
@ -24,38 +21,29 @@ jobs:
|
||||||
SENTRY_URL_PREFIX: "~/dashboard/static"
|
SENTRY_URL_PREFIX: "~/dashboard/static"
|
||||||
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
|
||||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
||||||
|
ENVIRONMENT: saleor-latest-staging
|
||||||
IS_CLOUD_INSTANCE: true
|
IS_CLOUD_INSTANCE: true
|
||||||
steps:
|
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
|
- uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
ref: ${{ env.GIT_REF }}
|
ref: ${{ github.event.inputs.git_ref || '' }}
|
||||||
|
|
||||||
- name: Package
|
- name: Package
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
run: |
|
run: |
|
||||||
npm ci
|
npm ci
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
- name: Configure AWS Credentials
|
- name: Configure AWS Credentials
|
||||||
uses: aws-actions/configure-aws-credentials@v1
|
uses: aws-actions/configure-aws-credentials@v1
|
||||||
with:
|
with:
|
||||||
aws-access-key-id: ${{ secrets.AWS_STAGING_ACCESS_KEY_ID }}
|
aws-access-key-id: ${{ secrets.AWS_STAGING_ACCESS_KEY_ID }}
|
||||||
aws-secret-access-key: ${{ secrets.AWS_STAGING_SECRET_ACCESS_KEY }}
|
aws-secret-access-key: ${{ secrets.AWS_STAGING_SECRET_ACCESS_KEY }}
|
||||||
aws-region: us-east-1
|
aws-region: us-east-1
|
||||||
|
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
run: |
|
run: |
|
||||||
aws s3 sync build/dashboard s3://${{ secrets.AWS_STAGING_DEPLOYMENT_BUCKET }}/${ENVIRONMENT}/static/
|
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