Blazor PWA githubActions
-
DevOps
Deploy PWA Blazor
- Do app blazor webAssembly standalone
- Do gitignore with command (dotnet new gitignore)
- git init
- git add .
- git commit -m "first commit"
- Do remote repo on GitHub
- change base tag at index.html
<!-- <base href="/" /> -->
<base href="https://<username>.github.io/<repoName>/" />
- After deploy on GitHub, go to setting -> pages -> source (githubActions)
- Go to the App and create the directories .github/workflows
- Inside of GitHub create a file main.yml and put
name: Deploy
on:
push:
branchs: ["main"]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Install .NET Wasm Tools
run: dotnet workload install wasm-tools
- name: Restore Dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release --no-restore
- name: Publish .NET
run: dotnet publish <projectName>.csproj -c:Release -o docs --nologo
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload
uses: actions/upload-pages-artifact@v3
with:
path: 'docs/wwwroot'
- name: Deploy
id: deployment
uses: actions/deploy-pages@v4
- git add .
- git commit -m "comment"
- git push
- And follow the deployment process at github