Merge pull request #208 from SierraSoftworks/dependabot/github_action… #239
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Website | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
env: | |
STAGING_DEPLOYMENT_CLIENT_ID: e0d46426-bd93-4bb2-9b5a-cabb0af9a509 | |
STAGING_STORAGE_CONTAINER: "$web" | |
STAGING_STORAGE_ACCOUNT: "sierrasoftworksrexbeta" | |
STAGING_CDN_RESOURCEGROUP: app-rex | |
STAGING_HEALTHCHECK: "https://rex-staging.sierrasoftworks.com/" | |
LIVE_DEPLOYMENT_CLIENT_ID: 25c19850-5c4e-4b6e-9257-a6e62b31e2e7 | |
LIVE_STORAGE_CONTAINER: "$web" | |
LIVE_STORAGE_ACCOUNT: "sierrasoftworksrex" | |
LIVE_CDN_RESOURCEGROUP: app-rex | |
LIVE_HEALTHCHECK: "https://rex.sierrasoftworks.com/" | |
permissions: | |
id-token: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
with: | |
submodules: true | |
- name: Install Node.js | |
uses: actions/[email protected] | |
- run: npm install | |
- run: npm run build --if-present | |
- name: Upload Artifact for Website | |
uses: actions/upload-artifact@v3 | |
with: | |
# Artifact name | |
name: site | |
# A file, directory or wildcard pattern that describes what to upload | |
path: ./src | |
deploy-staging: | |
runs-on: ubuntu-latest | |
if: github.actor != 'dependabot[bot]' | |
needs: [build] | |
environment: | |
name: Staging | |
url: ${{ env.STAGING_HEALTHCHECK }} | |
steps: | |
- name: Download Artifacts for Website | |
uses: actions/download-artifact@v3 | |
with: | |
name: site | |
path: ./out | |
- name: Login to Azure | |
uses: azure/login@v1 | |
with: | |
subscription-id: "108b3ddb-53fb-4344-80b2-d6c151912be6" | |
tenant-id: "a26571f1-22b3-4756-ac7b-39ca684fab48" | |
client-id: ${{ env.STAGING_DEPLOYMENT_CLIENT_ID }} | |
- name: Copy Artifacts to Storage | |
uses: azure/CLI@v1 | |
with: | |
inlineScript: | | |
echo "Uploading Site Contents" | |
az storage blob sync --container '${{ env.STAGING_STORAGE_CONTAINER }}' --account-name ${{ env.STAGING_STORAGE_ACCOUNT }} --source ./out | |
healthcheck-staging: | |
needs: deploy-staging | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Probe | |
uses: Jtalk/[email protected] | |
with: | |
url: ${{ env.STAGING_HEALTHCHECK }} | |
max-attempts: 5 | |
retry-delay: 10s | |
follow-redirect: true | |
deploy-live: | |
runs-on: ubuntu-latest | |
needs: healthcheck-staging | |
if: github.event_name == 'push' | |
environment: | |
name: Production | |
url: ${{ env.LIVE_HEALTHCHECK }} | |
steps: | |
- name: Download Artifacts for Website | |
uses: actions/download-artifact@v3 | |
with: | |
name: site | |
path: ./out | |
- name: Login to Azure | |
uses: azure/login@v1 | |
with: | |
subscription-id: "108b3ddb-53fb-4344-80b2-d6c151912be6" | |
tenant-id: "a26571f1-22b3-4756-ac7b-39ca684fab48" | |
client-id: ${{ env.LIVE_DEPLOYMENT_CLIENT_ID }} | |
- name: Copy Artifacts to Storage | |
uses: azure/CLI@v1 | |
with: | |
inlineScript: | | |
echo "Uploading Site Contents" | |
az storage blob sync --container '${{ env.LIVE_STORAGE_CONTAINER }}' --account-name ${{ env.LIVE_STORAGE_ACCOUNT }} --source ./out | |
healthcheck-live: | |
needs: deploy-live | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Probe | |
uses: Jtalk/[email protected] | |
with: | |
url: ${{ env.LIVE_HEALTHCHECK }} | |
max-attempts: 5 | |
retry-delay: 10s | |
follow-redirect: true |