Update dotnet.yml #13
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: .NET | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore | |
- name: Test | |
run: dotnet test | |
- name: Publish with dotnet | |
run: dotnet publish | |
- name: Configure Git | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
- name: Deploy to GitHub Pages | |
env: | |
GH_TOKEN: ${ secrets.GH_PAT } | |
run: | | |
# Clone the gh-pages branch using the provided token | |
git clone --depth=1 --branch=gh-pages https://${secrets.GH_PAT}@github.com/powerstrong/LuckGameSimulator gh-pages | |
cd gh-pages | |
# Copy the build output to the gh-pages branch | |
rsync -av --delete ../build/wwwroot/ . | |
# Commit and push changes | |
git add . | |
git commit -m "Deploying to gh-pages from ${GITHUB_SHA}" | |
git push origin gh-pages | |