-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (78 loc) · 2.79 KB
/
amf-ssr-site.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
name: Blazor SSR Site
on:
# Triggers the workflow on push or pull request events but only for the 'main' branch
push:
paths-ignore:
- "src/AnimeFeedManager.Web**"
- "src/AnimeFeedManager.Functions"
- "**/*.md"
branches:
- main
pull_request:
paths-ignore:
- "src/AnimeFeedManager.Web**"
- "src/AnimeFeedManager.Functions"
- "**/*.md"
types: [opened, synchronize, reopened, closed]
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
APP_PATH: "./src/AnimeFeedManager.Web"
AZURE_WEBAPP_PACKAGE_PATH: "." # set this to the path to your web app project, defaults to the repository root
DOTNET_VERSION: "8.0.x" # set this to the dot net version to use
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout the repo
- uses: actions/checkout@main
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
# Deploys infrastructure
- name: Deploy Azure Infrastructure
uses: Azure/arm-deploy@v1
id: infrastructure
with:
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION }}
resourceGroupName: ${{ secrets.AZURE_RG }}
template: ./deployment/main-blazor.bicep
parameters: passwordlessApiKey=${{ secrets.PASSWORDLESS_APIKEY }} passwordlessApiSecret=${{ secrets.PASSWORDLESS_APISECRET }}
failOnStdErr: false
- name: "Set Output as Env Var"
run: echo "AZURE_WEBAPP_NAME=${{ steps.infrastructure.outputs.appname }}" >> $GITHUB_ENV
# Setup node.js for tailwind
- name: Setup Node lts
uses: actions/setup-node@v4
with:
node-version: lts
- name: "npm install, build, and test"
run: |
npm install
npx tailwindcss -i ./Styles/app.css -o ./wwwroot/app.css --minify
working-directory: APP_PATH
# Setup .NET Core SDK
- name: Setup DotNet ${{ env.DOTNET_VERSION }} Environment
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
# Run dotnet build and publish
- name: dotnet build and publish
shell: bash
run: |
pushd '${{ env.APP_PATH }}'
dotnet restore
dotnet build --configuration Release
dotnet publish -c Release --property:PublishDir='${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/myapp'
popd
# Deploy to Azure Web apps
- name: "Run Azure webapp deploy action using publish profile credentials"
uses: azure/webapps-deploy@v3
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }} # Replace with your app name
package: "${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/myapp"
- name: logout
run: |
az logout