repo url change #32
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 and publish to gh pages | |
on: | |
push: | |
branches: [ "*" ] | |
env: | |
ASPNETCORE_ENVIRONMENT: Production | |
WEBAPP_PATH: ./ | |
WEBAPP_CSPROJ: BlazorStaticMinimalBlog.csproj | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Remove launchSettings.json (to not override ASPNETCORE_ENVIRONMENT) | |
run: rm ${{ env.WEBAPP_PATH }}Properties/launchSettings.json | |
- name: Change <base href="" /> in App.razor to match GitHub repo name | |
run: | | |
REPO_NAME=$(echo "${{ github.repository }}" | awk -F '/' '{print $NF}') | |
if [[ "$REPO_NAME" != *.github.io ]]; then | |
sed -i 's|<base href="/"*/>|<base href="/'$REPO_NAME'/" />|g' ${{ env.WEBAPP_PATH }}/Components/App.razor | |
fi | |
- name: Run webapp and generate static files | |
run: | | |
dotnet run --project ${{ env.WEBAPP_PATH }}${{env.WEBAPP_CSPROJ}} --configuration Release | |
- run: touch ${{ env.WEBAPP_PATH }}/output/.nojekyll #folder starting with _ are handled as jekyll. This file will prevent that. | |
- name: Deploy to GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: ${{ env.WEBAPP_PATH }}output | |