Skip to content

gh actons

gh actons #2

name: Deploy GitHub Pages
on:
push:
branches:
- main
release:
types:
- published
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: github-pages
cancel-in-progress: true
env:
APP_PROJECT: src/PrompterLive.App/PrompterLive.App.csproj
PAGES_ARTIFACT_ROOT: .artifacts/prompterlive-pages
PAGES_BASE_PATH: /${{ github.event.repository.name }}/
PUBLISH_ROOT: .artifacts/prompterlive-publish
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Configure GitHub Pages
uses: actions/configure-pages@v5
- name: Publish standalone WASM app
run: >
dotnet publish
"$APP_PROJECT"
-c Release
-o "$PUBLISH_ROOT"
-p:PrompterLiveBuildNumber=${{ github.run_number }}
- name: Prepare GitHub Pages artifact
run: |
mkdir -p "$PAGES_ARTIFACT_ROOT"
cp -R "$PUBLISH_ROOT/wwwroot/." "$PAGES_ARTIFACT_ROOT/"
sed -i "s#<base href=\"/\" />#<base href=\"${PAGES_BASE_PATH}\" />#g" "$PAGES_ARTIFACT_ROOT/index.html"
cp "$PAGES_ARTIFACT_ROOT/index.html" "$PAGES_ARTIFACT_ROOT/404.html"
touch "$PAGES_ARTIFACT_ROOT/.nojekyll"
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: ${{ env.PAGES_ARTIFACT_ROOT }}
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4