|
1 | | -name: Deploy to GitHub Pages - Legacy |
2 | | -# Run workflow on every push to the gh_pages_only branch (workarounds for WASM issues with Newtonsoft, etc. - maybe .NET5 isolated) |
| 1 | +name: Deploy to GitHub Pages |
| 2 | + |
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: [ main, gh_pages_only ] |
| 5 | + branches: [ main ] |
| 6 | + |
6 | 7 | jobs: |
7 | 8 | deploy-to-github-pages: |
8 | | - # use ubuntu-latest image to run steps on |
9 | 9 | runs-on: ubuntu-latest |
| 10 | + |
| 11 | + permissions: |
| 12 | + contents: write |
| 13 | + |
10 | 14 | steps: |
11 | | - # uses GitHub's checkout action to checkout code from the gh_pages_only branch |
12 | | - - uses: actions/checkout@v2 |
13 | | - with: |
14 | | - ref: gh_pages_only |
15 | | - |
16 | | - # sets up .NET Core SDK 3.1 |
17 | | - - name: Setup .NET Core SDK |
18 | | - uses: actions/setup-dotnet@v1 |
19 | | - with: |
20 | | - dotnet-version: 5.* |
21 | | - |
22 | | - # publishes Blazor project to the release-folder |
23 | | - - name: Publish .NET Core Project |
24 | | - run: dotnet publish demo/RulesEngineEditorWebAssembly/RulesEngineEditorWebAssembly.csproj -c Release -o release --nologo |
25 | | - |
26 | | - # changes the base-tag in index.html from '/' to 'BlazorGitHubPagesDemo' to match GitHub Pages repository subdirectory |
27 | | - - name: Change base-tag in index.html from / to RulesEngineEditor |
28 | | - run: sed -i 's/<base href="\/" \/>/<base href="\/RulesEngineEditor\/" \/>/g' release/wwwroot/index.html |
29 | | - |
30 | | - # add .nojekyll file to tell GitHub pages to not treat this as a Jekyll project. (Allow files and folders starting with an underscore) |
31 | | - - name: Add .nojekyll file |
32 | | - run: touch release/wwwroot/.nojekyll |
33 | | - |
34 | | - - name: Commit wwwroot to GitHub Pages |
35 | | - uses: JamesIves/github-pages-deploy-action@3.7.1 |
36 | | - with: |
37 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
38 | | - BRANCH: gh-pages |
39 | | - FOLDER: release/wwwroot |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v4 |
| 17 | + with: |
| 18 | + fetch-depth: 0 |
| 19 | + |
| 20 | + - name: Setup .NET SDK |
| 21 | + uses: actions/setup-dotnet@v4 |
| 22 | + with: |
| 23 | + dotnet-version: 8.0.x # or 9.0.x to match your TFM |
| 24 | + |
| 25 | + - name: Publish Blazor WASM |
| 26 | + run: dotnet publish demo/RulesEngineEditorWebAssembly/RulesEngineEditorWebAssembly.csproj \ |
| 27 | + -c Release -o release --nologo \ |
| 28 | + /p:NullabilityInfoContextSupport=true |
| 29 | + |
| 30 | + - name: Fix base href in index.html |
| 31 | + run: sed -i 's|<base href="/" />|<base href="/RulesEngineEditor/" />|g' release/wwwroot/index.html |
| 32 | + |
| 33 | + - name: Add .nojekyll |
| 34 | + run: touch release/wwwroot/.nojekyll |
| 35 | + |
| 36 | + - name: Deploy to GitHub Pages |
| 37 | + uses: JamesIves/github-pages-deploy-action@v4 |
| 38 | + with: |
| 39 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 40 | + BRANCH: gh-pages |
| 41 | + FOLDER: release/wwwroot |
0 commit comments