From e3deebcbf18383aecd077740cf8c47711d45ca57 Mon Sep 17 00:00:00 2001 From: Aaron Wentzel <16669785+awentzel@users.noreply.github.com> Date: Thu, 4 Nov 2021 14:45:46 -0700 Subject: [PATCH] add pr testing for color explorer --- .github/workflows/cd-color-stage.yml | 63 ++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cd-color-stage.yml b/.github/workflows/cd-color-stage.yml index 1a5a5309cec..178f28386b1 100644 --- a/.github/workflows/cd-color-stage.yml +++ b/.github/workflows/cd-color-stage.yml @@ -4,18 +4,23 @@ on: push: branches: - master + pull_request: + types: [opened, synchronize, reopened, closed] + branches: + - master + +env: + AZURE_WEBAPP_ACTIVE_STAGE_NAME: color-west-app + AZURE_WEBAPP_PASSIVE_STAGE_NAME: color-east-app + AZURE_WEBAPP_BUILD_PATH: sites/fast-color-explorer + AZURE_WEBAPP_DIST_PATH: sites/fast-color-explorer/www + AZURE_WEBAPP_SLOT_NAME: stage + ARTIFACT_NAME: color-explorer-site jobs: - build_deploy_linux: + build: runs-on: ubuntu-latest - env: - AZURE_WEBAPP_ACTIVE_STAGE_NAME: color-west-app - AZURE_WEBAPP_PASSIVE_STAGE_NAME: color-east-app - AZURE_WEBAPP_BUILD_PATH: sites/fast-color-explorer - AZURE_WEBAPP_DIST_PATH: sites/fast-color-explorer/www - AZURE_WEBAPP_SLOT_NAME: stage - steps: - name: Checkout Branch uses: actions/checkout@master @@ -35,6 +40,23 @@ jobs: npm i ls -lta + - uses: actions/upload-artifact@v2 + with: + name: ${{ env.ARTIFACT_NAME }} + path: ${{ env.AZURE_WEBAPP_DIST_PATH }} + + deploy_to_staging: + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + runs-on: ubuntu-latest + needs: build + + steps: + - name: Deploy PR + uses: actions/download-artifact@v2 + with: + name: ${{ env.ARTIFACT_NAME }} + path: ${{ env.AZURE_WEBAPP_DIST_PATH }} + - name: 'Deploy to Active Azure Region' uses: azure/webapps-deploy@v2 with: @@ -51,9 +73,32 @@ jobs: package: ${{ env.AZURE_WEBAPP_DIST_PATH }} slot-name: ${{ env.AZURE_WEBAPP_SLOT_NAME }} + deploy_pr: + if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') + runs-on: ubuntu-latest + needs: build + + steps: + - name: Deploy PR + uses: actions/download-artifact@v2 + with: + name: ${{ env.ARTIFACT_NAME }} + path: ${{ env.AZURE_WEBAPP_DIST_PATH }} + + - name: Deploy Component Explorer + id: deploypr + uses: Azure/static-web-apps-deploy@v0.0.1-preview + with: + azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APP_COLOR_PR_TOKEN }} + repo_token: ${{ secrets.GITHUB_TOKEN }} + action: 'upload' + app_location: ${{ env.AZURE_WEBAPP_DIST_PATH }} + output_location: '' + skip_app_build: true + notify: runs-on: ubuntu-latest - needs: build_deploy_linux + needs: deploy_to_staging steps: - name: Notify on Discord