Build params file #1
Workflow file for this run
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 Deployment | ||
on: | ||
workflow_call: | ||
inputs: | ||
rg: | ||
type: string | ||
required: true | ||
unique-label: | ||
type: string | ||
required: true | ||
secrets: | ||
azure-client-id: | ||
required: true | ||
azure-tenant-id: | ||
required: true | ||
azure-subscription-id: | ||
required: true | ||
github-pat: | ||
required: true | ||
permissions: | ||
id-token: write | ||
contents: read | ||
jobs: | ||
Deploy-Infrastructure: | ||
# Setup | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@main | ||
- name: azure-login | ||
uses: azure/login@v2 | ||
with: | ||
client-id: ${{ secrets.azure-client-id }} | ||
tenant-id: ${{ secrets.azure-tenant-id }} | ||
subscription-id: ${{ secrets.azure-subscription-id }} | ||
- name: azure-cli-verify | ||
uses: azure/cli@v2 | ||
with: | ||
azcliversion: latest | ||
inlineScript: | | ||
az account show | ||
- name: setup-dotnet | ||
uses: actions/setup-dotnet@v2 | ||
with: | ||
dotnet-version: '8.0' | ||
# Bicep | ||
- name: bicep-install | ||
run: az bicep upgrade | ||
- name: generate-bicep-parameters | ||
run: | | ||
echo "{ | ||
\"$schema\": \"https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#\", | ||
\"contentVersion\": \"1.0.0.0\", | ||
\"parameters\": { | ||
\"githubPat\": { | ||
\"value\": \"${{ secrets.github-pat }}\" | ||
}, | ||
\"uniqueName\": { | ||
\"value\": \"${{ inputs.rg }}\" | ||
} | ||
} | ||
}" > parameters.json | ||
- name: bicep-deploy | ||
uses: azure/arm-deploy@v2 | ||
with: | ||
subscriptionId: ${{ secrets.azure-subscription-id }} | ||
resourceGroupName: ${{ inputs.rg }} | ||
template: ./bicep/main.bicep | ||
failOnStdErr: false | ||
parameters: @parameters.json | ||
deploymentMode: Incremental | ||
# Web App code | ||
- name: bicep-output-webappname | ||
uses: azure/cli@v2 | ||
with: | ||
inlineScript: | | ||
#!/bin/bash | ||
outputValue=$( az deployment group show -g ${{ inputs.rg }} --name main --query properties.outputs.webAppName.value -o tsv) | ||
echo "WebAppName=$outputValue" >> $GITHUB_ENV | ||
- name: dotnet-build-publish-webapp | ||
run: | | ||
dotnet restore ./src/Web/Web.csproj | ||
dotnet build ./src/Web/Web.csproj --configuration Release | ||
dotnet publish ./src/Web/Web.csproj -c Release -o './src/Web/output' | ||
- name: azure-deploy-webapp | ||
uses: azure/webapps-deploy@v2 | ||
with: | ||
app-name: ${{ env.WebAppName }} | ||
package: './src/Web/output' | ||
# Function code | ||
- name: bicep-output-functionappname | ||
uses: azure/cli@v2 | ||
with: | ||
inlineScript: | | ||
#!/bin/bash | ||
outputValue=$( az deployment group show -g ${{ inputs.rg }} --name main --query properties.outputs.functionAppName.value -o tsv) | ||
echo "FunctionAppName=$outputValue" >> $GITHUB_ENV | ||
- name: dotnet-build-publish-functionapp | ||
run: | | ||
dotnet restore ./src/Workflow/Workflow.csproj | ||
dotnet build ./src/Workflow/Workflow.csproj --configuration Release | ||
dotnet publish ./src/Workflow/Workflow.csproj -c Release -o './src/Workflow/output' | ||
- name: azure-deploy-functionapp | ||
uses: Azure/functions-action@v1.4.8 | ||
with: | ||
app-name: ${{ env.FunctionAppName }} | ||
package: './src/Workflow/output' | ||
# Capture and log the Bicep outputs | ||
- name: output-unique-name | ||
run: | | ||
echo "uniqueName: ${{ steps.bicep-deploy.outputs.uniqueName }}" |