initial #1
This file contains hidden or 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 | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Determine base href | |
| id: basehref | |
| shell: bash | |
| run: | | |
| REPO_NAME="${{ github.event.repository.name }}" | |
| OWNER="${{ github.repository_owner }}" | |
| if [ "$REPO_NAME" = "${OWNER}.github.io" ]; then | |
| echo "value=/" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "value=/${REPO_NAME}/" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Publish Blazor app | |
| run: dotnet publish ReminderApp/ReminderApp.csproj -c Release -o publish | |
| - name: Set base href for GitHub Pages | |
| shell: bash | |
| run: | | |
| BASE="${{ steps.basehref.outputs.value }}" | |
| INDEX="publish/wwwroot/index.html" | |
| sed -i "s|<base href=\"/\" />|<base href=\"${BASE}\" />|" "$INDEX" | |
| echo "Base href set to: ${BASE}" | |
| - name: Add .nojekyll | |
| run: touch publish/wwwroot/.nojekyll | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: publish/wwwroot | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |