Merge pull request #22 from PinguApps/feature/6-feat-add-tests #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Deploy Demo Site | |
permissions: | |
contents: write | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
env: | |
DOTNET_VERSION: '6.0' | |
BRANCH: 'main' | |
LIBRARY_PATH: 'src/PinguApps.Blazor.QRCode' | |
DEMO_PATH: 'src/BlazorWasmNet6' | |
jobs: | |
changes: | |
if: ${{ github.event_name != 'workflow_dispatch' }} | |
runs-on: ubuntu-latest | |
outputs: | |
changes-detected: ${{ steps.filter.outputs.changes }} | |
steps: | |
- uses: actions/checkout@v2 | |
name: Checkout | |
with: | |
ref: ${{ env.BRANCH }} | |
- uses: dorny/paths-filter@v2 | |
name: Checking for changes in either demo site or library code | |
id: filter | |
with: | |
base: ${{ env.BRANCH }} | |
filters: | | |
changes: | |
- '${{ env.LIBRARY_PATH }}/**' | |
- '${{ env.DEMO_PATH }}/**' | |
- name: Annotate Changes | |
uses: mholetzko/[email protected] | |
with: | |
title: "Changes to build?" | |
info: ${{ steps.filter.outputs.changes_count }} changes - ${{ steps.filter.outputs.changes }} | |
deploy-to-github-pages: | |
needs: changes | |
if: ${{ !failure() && ((github.event_name == 'workflow_dispatch') || needs.changes.outputs.changes-detected == 'true') }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
name: Checkout | |
with: | |
ref: ${{ env.BRANCH }} | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: | | |
${{ env.DOTNET_VERSION }} | |
7.0 | |
8.0 | |
- name: Test | |
run: dotnet test -c Release .\src\PinguApps.Blazor.QRCode.Tests\ | |
- name: Publish Project | |
run: dotnet publish src/BlazorWasmNet6/BlazorWasmNet6.csproj -c Release -f net6.0 --nologo | |
- name: Change base tag | |
run: sed -i 's/<base href="\/" \/>/<base href="\/Blazor.QRCode\/" \.>/g' src/BlazorWasmNet6/bin/Release/net6.0/publish/wwwroot/index.html | |
- name: copy index.html to 404.html | |
run: cp src/BlazorWasmNet6/bin/Release/net6.0/publish/wwwroot/index.html src/BlazorWasmNet6/bin/Release/net6.0/publish/wwwroot/404.html | |
- name: Add .nojekyll file | |
run: touch src/BlazorWasmNet6/bin/Release/net6.0/publish/wwwroot/.nojekyll | |
- name: Commit wwwroot to GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages | |
folder: src/BlazorWasmNet6/bin/Release/net6.0/publish/wwwroot |