Skip to content

Commit

Permalink
add pr testing for color explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
awentzel committed Nov 4, 2021
1 parent 0308a3f commit e3deebc
Showing 1 changed file with 54 additions and 9 deletions.
63 changes: 54 additions & 9 deletions .github/workflows/cd-color-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit e3deebc

Please sign in to comment.