Skip to content

Fix

Fix #438

Workflow file for this run

name: Publish Frontend
on:
push:
branches:
- master
paths:
- '.github/workflows/frontend.yml'
- 'src/**'
- '!src/BUTR.Site.NexusMods.Server/**'
- 'build/**'
workflow_dispatch:
env:
# Disable the .NET logo in the console output.
DOTNET_NOLOGO: true
# Disable the .NET first time experience to skip caching NuGet packages and speed up the build.
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending .NET CLI telemetry to Microsoft.
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup
uses: butr/actions-common-setup@v2
with:
fetch-depth: 0
github-token: ${{secrets.GITHUB_TOKEN}}
- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x.x
- name: Build Server
run: dotnet build src/BUTR.Site.NexusMods.Server/BUTR.Site.NexusMods.Server.csproj --configuration Release;
- name: Restore Workload
run: dotnet workload restore src/BUTR.Site.NexusMods.Client/BUTR.Site.NexusMods.Client.csproj;
- name: Publish Client
run: dotnet publish src/BUTR.Site.NexusMods.Client/BUTR.Site.NexusMods.Client.csproj --configuration Release --output build;
- name: Change base href in index.html
run: sed -i 's/<base href="\/" \/>/<base href="\/BUTR.Site.NexusMods\/" \/>/g' build/wwwroot/index.html
# copy index.html to 404.html to serve the same file when a file is not found
- name: copy index.html to 404.html
run: cp build/wwwroot/index.html build/wwwroot/404.html
# 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 build/wwwroot/.nojekyll
- name: Deploy to Github Pages
uses: crazy-max/ghaction-github-pages@v4
with:
target_branch: gh-pages
build_dir: build/wwwroot
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}