Skip to content

Commit e5789f0

Browse files
committed
Add GitHub Actions deployment
1 parent 249f067 commit e5789f0

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

.github/workflows/deploy.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build and Publish Blazor UI Framework
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
env:
9+
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.'
10+
ACCOUNT_NAME: blazorui
11+
PROFILE_NAME: stoicdreamsprofile
12+
WEB_APP_NAME: 'StoicDreams.SampleWebsite'
13+
BUILD_CONFIGURATION: 'Release'
14+
15+
jobs:
16+
build-and-deploy:
17+
runs-on: windows-latest
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Setup .NET
21+
uses: actions/setup-dotnet@v3
22+
with:
23+
dotnet-version: 6.0.x
24+
- name: Restore dependencies
25+
run: dotnet restore
26+
- name: Build
27+
run: dotnet build --no-restore
28+
- name: Test
29+
run: dotnet test --no-build --verbosity normal
30+
- name: Publish
31+
run: dotnet publish '${{ env.WEB_APP_NAME }}/${{ env.WEB_APP_NAME }}.csproj --configuration ${{ env.BUILD_CONFIGURATION }} --no-restore --no-build --self-contained true /p:LinkDuringPublish=false
32+
- name: Azure Login
33+
uses: azure/login@v1
34+
with:
35+
creds: ${{ secrets.AZURE_CREDENTIALS }}
36+
- name: Remove Old Files
37+
uses: azure/CLI@v1
38+
with:
39+
inlineScript: |
40+
az storage blob delete-batch -s '$web' --account-name ${{ env.ACCOUNT_NAME }}
41+
- name: Copy Files to Azure Blob Storage
42+
uses: azure/CLI@v1
43+
with:
44+
inlineScript: |
45+
az storage copy -s '${{ env.WEB_APP_NAME }}/bin/Release/net7.0/publish/wwwroot/*' --destination-account-name ${{ env.ACCOUNT_NAME }} --destination-container '$web' --recursive
46+
- name: Purge Storage Cache
47+
uses: azure/CLI@v1
48+
with:
49+
inlineScript: |
50+
az cdn endpoint purge -g ${{ secrets.AZURE_RESOURCE_GROUP }} -n ${{ env.ACCOUNT_NAME }} --profile-name ${{ env.PROFILE_NAME }} --content-paths '/*'
51+
- name: logout
52+
run: |
53+
az logout
54+
if: always()

0 commit comments

Comments
 (0)