Skip to content

Use specific version instead of branch name (#4225) #1153

Use specific version instead of branch name (#4225)

Use specific version instead of branch name (#4225) #1153

name: Deploy Dashboard to main staging
on:
push:
branches:
- main
- 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 }}
APPS_MARKETPLACE_API_URI: "https://apps.staging.saleor.io/api/v2/saleor-apps"
IS_CLOUD_INSTANCE: true
steps:
- uses: actions/checkout@v2
- name: Set custom version
run: |
HASH=$(git rev-parse --short HEAD)
CURRENT_VERSION=$(jq -r .version package.json)
echo "CUSTOM_VERSION=${CURRENT_VERSION}-${HASH}" >> $GITHUB_ENV
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
- 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 master staging
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/
for i in {1..3}; do aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_STAGING_CF_DIST_ID }} --paths "/dashboard*" && break || sleep 5; done
- name: Deploy fake production
run: |
aws s3 sync build/dashboard s3://${{ secrets.AWS_STAGING_DEPLOYMENT_BUCKET }}/saleor-fake-production/static/
aws s3 cp build/dashboard/index.html s3://${{ secrets.AWS_STAGING_DEPLOYMENT_BUCKET }}/saleor-fake-production/
for i in {1..3}; do aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_STAGING_CF_DIST_ID }} --paths "/dashboard*" && break || sleep 5; done
- name: Notify Slack
if: ${{ always() }}
env:
JOB_DEPLOYMENT_KIND: staging
JOB_STATUS: ${{ job.status }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CLOUD_DEPLOYMENTS_WEBHOOK_URL }}
SLACK_MENTION_GROUP_ID: ${{ secrets.SLACK_DASHBOARD_GROUP_ID }}
JOB_TITLE: "Dashboard deployment to saleor-master-staging"
run: |
python3 ./.github/workflows/notify/notify-slack.py