Browser builds being annoying about native libs #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Avalonia WASM app to Github Page | |
env: | |
PUBLISH_DIR: ColorTiles.Browser/bin/Release/net7.0/browser-wasm/AppBundle | |
REPO_NAME: ${{ github.event.repository.name }} | |
REPO_OWNER: ${{ github.event.repository.owner.name }} | |
# Control when the action will run. Trigger the workflow on push or pull request on master branch where the 'ColorTiles' & 'ColorTiles.Browser' folders are modified | |
on: | |
push: | |
branches: [ master ] | |
paths: | |
- 'ColorTiles/**' | |
- 'ColorTiles.Browser/**' | |
pull_request: | |
branches: [ master ] | |
paths: | |
- 'ColorTiles/**' | |
- 'ColorTiles.Browser/**' | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version of the app' | |
required: true | |
default: '1.0.0' | |
# Job that build the app, and deploy it to Github Page (.NET 7.00.x) | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 7.0.x | |
- name: Install Workloads | |
run: dotnet workload install wasm-tools | |
- name: Publish | |
run: dotnet publish ColorTiles.Browser -c Release | |
- name: Replace Base href in index.html with Color-Tiles.Avalonia | |
run: sed -i 's/<base href="\/" \/>/<base href="\/${{ env.REPO_NAME }}\/" \/>/g' ${{ env.PUBLISH_DIR }}/index.html | |
- name: Replace {REPO_NAME} in index.html with repo name | |
run: sed -i 's/{REPO_NAME}/${{ env.REPO_NAME }}/g' ${{ env.PUBLISH_DIR }}/index.html | |
- name: Replace {REPO_OWNER} in index.html with repo owner | |
run: sed -i 's/{REPO_OWNER}/${{ env.REPO_OWNER }}/g' ${{ env.PUBLISH_DIR }}/index.html | |
- name: Add * binary to .gitattributes | |
run: echo "* binary" >> .gitattributes | |
- name: Copy index to 404 | |
run: cp ${{ env.PUBLISH_DIR }}/index.html ${{ env.PUBLISH_DIR }}/404.html | |
- name: Deploy to Github Page | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages | |
folder: ${{ env.PUBLISH_DIR }} |