54 lines
1.9 KiB
YAML
54 lines
1.9 KiB
YAML
on:
|
|
workflow_call:
|
|
inputs:
|
|
environment:
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
deploy:
|
|
environment:
|
|
name: ${{ inputs.environment }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: azure/login@v1
|
|
with:
|
|
creds: ${{ secrets.AZURE_CREDENTIALS }}
|
|
|
|
- name: Set backend env variables
|
|
uses: azure/powershell@v1
|
|
with:
|
|
azPSVersion: "latest"
|
|
inlineScript: |
|
|
az extension add --name containerapp
|
|
$apiUrl = "https://$(az containerapp show -g ${{ secrets.AZURE_RESOURCE_GROUP_NAME }} -n ${{ secrets.API_RESOURCE_NAME }} -o tsv --query properties.configuration.ingress.fqdn)"
|
|
echo "PODCAST_API_URL=$apiUrl" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
|
|
|
|
- name: Set Blazor WASM app settings
|
|
uses: microsoft/variable-substitution@v1
|
|
with:
|
|
files: "src/Web/Client/wwwroot/appsettings.json"
|
|
env:
|
|
PodcastApi.BaseAddress: ${{ env.PODCAST_API_URL }}
|
|
ListenTogetherHub: "https://${{secrets.HUB_WEBAPP_NAME}}.azurewebsites.net/listentogether"
|
|
|
|
- name: Deploy Bicep template
|
|
uses: azure/powershell@v1
|
|
with:
|
|
azPSVersion: "3.1.0"
|
|
inlineScript: |
|
|
az deployment group create -n ghaction -g ${{ secrets.AZURE_RESOURCE_GROUP_NAME }} --template-file deploy/Web/web.bicep --parameters webAppName=${{ secrets.WEBAPP_NAME }} servicePlanName=${{ secrets.SERVICE_PLAN_NAME }} servicePlanSku=${{ secrets.SERVICE_PLAN_SKU }} hubWebAppName=${{ secrets.HUB_WEBAPP_NAME }}
|
|
|
|
- name: Download web artifacts
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: drop
|
|
path: web
|
|
|
|
- name: Azure WebApp
|
|
uses: Azure/webapps-deploy@v2
|
|
with:
|
|
app-name: ${{ secrets.WEBAPP_NAME }}
|
|
package: web |