Deployment
Microsite
Deploying in Azure/GitHub Actions
In the root of your project:
- create a .github directory
- inside .github create a workflows directory
- inside workflows create a file named azure-deploy.yml
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
The first build should fail from not having a deployment token
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:
- Got the settings tab of the repository
- Select Secrets/Actions on the left side pane
- Create a new repository secret named AZURE_STATIC_WEB_APPS_API_TOKEN
- Provide the token from DevOps team
The next build should pass.
DNS Request
Once you’ve confirmed successful deployment you can request a DNS by:
- Got to the following link https://console.hcp.uhg.com/products/dns/create-dns
- Click start
- Select view Both
- Alias name is the name it will be
- Click search
- Click continue
- Enter your MSID
- Select Admin Global Group from the dropdown
- Click continue
Target FQDN is the first URL you received in the following format
Click continue and inform DevOps that you have requested the DNS