Skip to main content

Deployment

Microsite

Deploying in Azure/GitHub Actions

In the root of your project:

  1. create a .github directory
  2. inside .github create a workflows directory
  3. inside workflows create a file named azure-deploy.yml

image

The following code goes in the azure-deploy.yml file

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Deploy Batch Modernization Microsite to Azure Static Web Apps

env:
APP_LOCATION: "/" # location of your client code
API_LOCATION: "" # location of your api source code - optional
APP_ARTIFACT_LOCATION: "/build" # location of client code build output

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main

permissions:
issues: write
contents: read

jobs:
build_and_deploy:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
name: Build and Deploy
steps:
- uses: actions/checkout@v3

with:
submodules: true
- name: Build And Deploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: "upload"
app_location: ${{ env.APP_LOCATION }}
api_location: ${{ env.API_LOCATION }}
app_artifact_location: ${{ env.APP_ARTIFACT_LOCATION }}

close:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close
steps:
- name: Close
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
action: "close"

This line is what your action/workflow will be called in GitHub actions

name: Deploy Batch Modernization Microsite to Azure Static Web Apps

This line declares what branch will trigger the build/deploy

on: push: branches: -main;

This line states the name of the repository secret

with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}

Once this file is committed to the repository go to the Actions tab of the repository

image

The first build should fail from not having a deployment token

image

Now you are ready to contact the DevOps team and request a deployment. They will provide the initial url and token. Once you have the token:

  1. Got the settings tab of the repository
  2. Select Secrets/Actions on the left side pane
  3. Create a new repository secret named AZURE_STATIC_WEB_APPS_API_TOKEN
  4. Provide the token from DevOps team

image

The next build should pass.

image

DNS Request

Once you’ve confirmed successful deployment you can request a DNS by:

  1. Got to the following link https://console.hcp.uhg.com/products/dns/create-dns
  2. Click start
  3. Select view Both
  4. Alias name is the name it will be

image

  1. Click search
  2. Click continue
  3. Enter your MSID
  4. Select Admin Global Group from the dropdown
  5. Click continue

image

Target FQDN is the first URL you received in the following format

image

Click continue and inform DevOps that you have requested the DNS