Skip to content

style: move Clients to Monopoly.Web #10

style: move Clients to Monopoly.Web

style: move Clients to Monopoly.Web #10

Workflow file for this run

name: Deploy to GitHub Pages
# 設定值
env:
GitHub_Pages_PathName: "Monopoly" # 網址目錄名稱 (EX: https://app.github.io/Monopoly/ 的Monopoly部分
FRONTEND_PUBLISH_Name: "Client" # 前端專案目錄名稱(必須同專案名稱)
on:
push:
branches: [main, develop, devops] #偵測分支
paths:
- "Client/**" #偵測目錄
- ".github/workflows/Front-End.yml" #偵測檔案"
jobs:
deploy-to-github-pages:
# 使用ubuntu
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ env.FRONTEND_PUBLISH_Name }} # 全局設定工作目錄
steps:
# 使用checkout actions
- uses: actions/checkout@v3
# 安裝.NET Core SDK
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
# # 執行單元測試專案
# - name: Run Unit Test
# run: dotnet test --no-build
# 發佈程式到Release資料夾
- name: Publish .NET Core Project
run: dotnet publish -c Release -o release --nologo
# 修改index.html的base href -- 從"/"改為"/TodoBlazor/"
- name: Change base-tag in index.html from / to TodoBlazor
run: sed -i 's/<base href="\/" \/>/<base href="\/${{ env.GitHub_Pages_PathName }}\/" \/>/g' release/wwwroot/index.html
# 複製index.html內容到404.html
- name: copy index.html to 404.html
run: cp release/wwwroot/index.html release/wwwroot/404.html
# 加入一個.nojekyll檔案
- name: Add .nojekyll file
run: touch release/wwwroot/.nojekyll
# 將release/wwwroot的程式碼,push到gh-pages分支
- name: Commit wwwroot to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4.3.3
with:
branch: gh-pages
folder: ${{ env.FRONTEND_PUBLISH_Name }}/release/wwwroot