-
Notifications
You must be signed in to change notification settings - Fork 4
79 lines (69 loc) · 2.55 KB
/
azure-static-web-app.yml
File metadata and controls
79 lines (69 loc) · 2.55 KB
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
name: Azure Static WebApp (Blazor WebAssembly)
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main
workflow_dispatch:
inputs:
prod_release:
description: 'Do you want to release to production?'
required: true
default: false
type: boolean
jobs:
build_and_deploy_job:
if: ${{ inputs.prod_release }} || (github.event_name == 'pull_request' && github.event.action != 'closed')
runs-on: ubuntu-latest
env:
DOTNET_VERSION: "net9.0"
DOTNET_CLI_TELEMETRY_OPTOUT: 1
PROJECT: "BlazorExpress.ChartJS.Demo.WebAssembly/BlazorExpress.ChartJS.Demo.WebAssembly.csproj"
BUILD_CONFIG: "Release"
name: Build and Deploy Job
steps:
- uses: actions/checkout@v4
with:
submodules: true
lfs: false
# Setup .NET 10.0
- name: Setup .NET 9.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
# .NET Restore
- name: .NET Restore
run: dotnet restore ${{ env.PROJECT }}
# .NET Build
- name: .NET Build
run: dotnet build ${{ env.PROJECT }} -c ${{ env.BUILD_CONFIG }} -f ${{ env.DOTNET_VERSION }} --no-restore
# .NET Publish
- name: .NET Publish
run: dotnet publish ${{ env.PROJECT }} -c ${{ env.BUILD_CONFIG }} -o output -f ${{ env.DOTNET_VERSION }} --no-build
# Azure Static Web App Deployment Action
- name: Build And Deploy Blazor WASM App
id: swa
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_WITTY_FOREST_0C3A9ED10 }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: "upload"
app_location: "output/wwwroot" # Path to your .csproj folder
api_location: "" # Leave empty if no API
output_location: "" # Leave empty when using 'upload' action with a pre-built app
skip_api_build: true
skip_app_build: true
close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_WITTY_FOREST_0C3A9ED10 }}
action: "close"