-
Notifications
You must be signed in to change notification settings - Fork 2
67 lines (54 loc) · 2.93 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# 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.7.24407.12'
# 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.