Skip to content

Publish Weekly Xamarin Blazor #45

Publish Weekly Xamarin Blazor

Publish Weekly Xamarin Blazor #45

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Publish Weekly Xamarin Blazor
# Controls when the workflow will run
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Allows you to run this workflow manually from the Actions tab
env:
DOTNET_VERSION: '9.0.100-preview.4.24267.66'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "publish-weekly-xamarin-blazor"
publish-weekly-xamarin-blazor:
# The type of runner that the job will run on
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./src/BlazorApp
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Runs a single command using the runners shell
- name: Setup .NET 9 SDK
uses: actions/setup-dotnet@v3
with:
# Optional SDK version to use. If not provided, will install global.json version when available. Examples: 2.2.104, 3.1, 3.1.x
dotnet-version: ${{ env.DOTNET_VERSION }}
# Whether prerelease versions should be matched with non-exact versions (for example 5.0.0-preview.6 being matched by 5, 5.0, 5.x or 5.0.x). Defaults to false if not provided.
# Install WebAssembly workload
- name: Install WebAssembly workload
run: dotnet workload install wasm-tools
# Restore dependencies
- name: Restore dependencies
run: dotnet restore ./BlazorApp.Wasm/BlazorApp.Wasm.csproj
# Updates the base-tag in index.html from '/' to 'WeeklyXamarinBlazor' to match GitHub Pages repository subdirectory
- name: Updates the base-tag in index.html from / to WeeklyXamarinBlazor
run: sed -i 's/<base href="\/" \/>/<base href="\/WeeklyXamarinBlazor\/" \/>/g' ./BlazorApp.Wasm/wwwroot/index.html
# Publish the WASM Project in Release mode
- name: Publish the WASM Project in Release mode
run: dotnet publish ./BlazorApp.Wasm/BlazorApp.Wasm.csproj -c Release -o blazorwasm
# 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 blazorwasm/wwwroot/index.html blazorwasm/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 blazorwasm/wwwroot/.nojekyll
# Commit wwwroot to GitHub Pages
- name: Commit wwwroot to GitHub Pages
uses: JamesIves/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages # The branch the action should deploy to.
folder: ./src/BlazorApp/blazorwasm/wwwroot # The folder the action should deploy.