This repository has been archived by the owner on May 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 751
96 lines (81 loc) · 3.09 KB
/
template-web.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
on:
workflow_call:
inputs:
environment:
required: true
type: string
jobs:
build:
environment:
name: ${{ inputs.environment }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: "7.0.x"
- name: Install wasm-tools
run: dotnet workload install wasm-tools
- 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: Build
run: dotnet build src/Web/Server --configuration Release
- name: Publish
run: dotnet publish --configuration Release src/Web/Server --output web
- uses: actions/upload-artifact@v3
with:
name: drop
path: web
deploy:
needs: build
environment:
name: ${{ inputs.environment }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Deploy Bicep template
uses: azure/powershell@v1
with:
azPSVersion: "3.1.0"
inlineScript: |
$deploymentName = 'ghaction${{ github.sha }}'
$resourceGroupName = '${{ secrets.AZURE_RESOURCE_GROUP_NAME }}'
$webAppName = '${{ secrets.WEBAPP_NAME }}'
$servicePlanName = '${{ secrets.SERVICE_PLAN_NAME }}'
$servicePlanSku = '${{ secrets.SERVICE_PLAN_SKU }}'
$hubWebAppName = '${{ secrets.HUB_WEBAPP_NAME }}'
$apiName = '${{ secrets.API_RESOURCE_NAME }}'
az deployment group create -n "$($deploymentName)" `
--resource-group "$($resourceGroupName)" `
--template-file deploy/Web/web.bicep `
--parameters webAppName="$($webAppName)" servicePlanName="$($servicePlanName)" servicePlanSku="$($servicePlanSku)" hubWebAppName="$($hubWebAppName)" apiName="$($apiName)"
- 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