Azure Resource Manager Provision and Deploy #17
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: Azure Resource Manager Provision and Deploy | |
on: workflow_dispatch | |
jobs: | |
#====== Provision and Deploy ======# | |
provision_and_deploy: | |
name: "Provision and Deploy" | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout repository | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
# Login to Azure | |
- name: Login to Azure | |
uses: azure/login@v2 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
# Create or Update Resource Group | |
- name: Create or Update Resource Group | |
run: | | |
az group create --name ${{ vars.RESOURCE_GROUP_NAME }} --location ${{ vars.RESOURCE_LOCATION }} | |
# Deploy ARM template | |
- name: Deploy ARM Template | |
uses: azure/arm-deploy@v2 | |
with: | |
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
resourceGroupName: ${{ vars.RESOURCE_GROUP_NAME }} | |
template: ./infra/azuredeploy.json | |
deploymentMode: Incremental | |
parameters: staticSites_name=${{ vars.STATIC_WEB_APP_NAME }} staticSites_location=${{ vars.RESOURCE_LOCATION }} staticSites_sku=${{ vars.STATIC_WEB_APP_SKU }} | |
# Get Azure Static Web App deployment token | |
- name: Get Azure Static Web App deployment token | |
id: get-token | |
run: | | |
TOKEN=$(az staticwebapp secrets list --name ${{ vars.STATIC_WEB_APP_NAME }} --resource-group ${{ vars.RESOURCE_GROUP_NAME }} --query "properties.apiKey" -o tsv) | |
echo "STATIC_WEB_APP_TOKEN=$TOKEN" >> $GITHUB_ENV | |
# Deploy to Azure Static Web Apps | |
- name: Deploy | |
id: builddeploy | |
uses: Azure/static-web-apps-deploy@v1 | |
with: | |
azure_static_web_apps_api_token: ${{ env.STATIC_WEB_APP_TOKEN }} | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
action: 'upload' | |
app_location: '/src/Blazor.WebAssembly' | |
output_location: 'wwwroot' | |
app_build_command: 'dotnet publish -c Release' | |
# Logout of Azure | |
- name: Logout of Azure | |
run: | | |
az logout |