Add Theme switcher #62
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: Deploy to Github Pages | |
# Run workflow on every push to the master branch | |
on: | |
push: | |
branches: [ master ] | |
jobs: | |
deploy-to-github-pages: | |
# use ubuntu-latest image to run steps on | |
runs-on: ubuntu-latest | |
steps: | |
# uses GitHub's checkout action to checkout code form the master branch | |
- uses: actions/checkout@v2 | |
# sets up .NET Core SDK 3.1 | |
- name: Setup .NET Core SDK | |
uses: actions/setup-dotnet@v1 | |
# publishes Blazor project to the release-folder | |
- name: Publish .NET Core Project | |
run: dotnet publish src/mohdali.github.io/mohdali.github.io.csproj -c Release -o Prerender/output --nologo | |
# Use NodeJS react-snap utitility to prerender static website | |
- name: prerender Blazor client | |
working-directory: Prerender | |
run: npx react-snap | |
# change base tag in all html files to include subfolder | |
- name: Change base tag | |
working-directory: Prerender/output/wwwroot | |
run: | | |
find . -name "*.html" | while read htmlFile; do | |
sed -i 's/<script>var Module; window.__wasmmodulecallback__(); delete window.__wasmmodulecallback__;<\/script><script src="_framework\/dotnet.[a-zA-Z0-9.]\+.js" defer="" integrity="sha256-.\+" crossorigin="anonymous"><\/script>//g' $htmlFile | |
done | |
# add .nojekyll file to tell GitHub pages to not treat this as a Jekyll project. (Allow files and folders starting with an underscore) | |
- name: Add .nojekyll file | |
run: touch Prerender/output/wwwroot/.nojekyll | |
- name: Commit wwwroot to GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@3.7.1 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH: gh-pages | |
FOLDER: Prerender/output/wwwroot | |