반응형
Git 이 초기화 되어있는 폴더에서 아래의 명령어를 실행해 줍니다.
dotnet new blazorwasm # Blazor WebAssembly 프로젝트 생성
dotnet new gitignore # dotnet 의 gitignore 생성
그리고 나서 Github에 프로젝트를 Push하고, Action에 들어가 아래의 코드로 action을 생성합니다.
name: Deploy to GitHub Pages
# develop 브랜치에 push가 발생할 때 마다 실행
on:
push:
branches: [ develop ]
jobs:
deploy-to-github-pages:
runs-on: ubuntu-18.04
steps:
# develop branch를 기준으로 체크아웃
- uses: actions/checkout@v2
with:
ref: develop
# .NET Core SDK 설치
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v1
# BlazorPage 프로젝트를 릴리즈버전으로 빌드하고 release폴더에 저장
- name: BlazorPage 릴리즈 버전으로 빌드
run: dotnet publish BlazorPage.csproj -c Release -o release --nologo
# changes the base-tag in index.html from '/' to 'BlazorPage' to match GitHub Pages repository subdirectory
- name: Change base-tag in index.html from / to BlazorPage
run: sed -i 's/<base href="\/" \/>/<base href="\/BlazorPage\/" \/>/g' release/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 release/wwwroot/index.html release/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 release/wwwroot/.nojekyll
- name: Commit wwwroot to GitHub Pages
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.Repository_Access_Token }}
BRANCH: gh-pages
FOLDER: release/wwwroot
반응형
'프로그래밍 > .NET' 카테고리의 다른 글
Markdown파일을 읽어와 렌더링하기 (0) | 2023.01.04 |
---|---|
Generic Host에서 EF Core MySql 사용하기 (0) | 2022.12.22 |
Visual Studio 자동 줄바꿈 없애기 (0) | 2022.09.23 |
Firestore 연동하기 (0) | 2022.02.06 |
관리자 권한으로 프로젝트 실행하기 (1) | 2021.07.18 |