mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2025-04-22 03:59:35 +08:00
46 lines
1.4 KiB
YAML
46 lines
1.4 KiB
YAML
# This workflow will build a .NET project and push the built files to the latest branch
|
|
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
|
|
|
|
name: .NET
|
|
|
|
on:
|
|
push:
|
|
branches: [ "master" ]
|
|
pull_request:
|
|
branches: [ "master" ]
|
|
|
|
jobs:
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0 # Fetch all history for all branches
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: 8.0.x
|
|
- name: Restore dependencies
|
|
run: dotnet restore
|
|
- name: Build
|
|
run: dotnet build --no-restore
|
|
- name: Test
|
|
run: dotnet test --no-build --verbosity normal
|
|
- name: Prepare files for latest branch
|
|
run: |
|
|
mkdir -p latest
|
|
cp -r ./bin/Debug/net8.0/FunGame.Core.dll ./bin/Debug/net8.0/FunGame.Core.xml ./bin/Debug/net8.0/FunGame.Core.deps.json ./latest/
|
|
- name: Commit and push to latest
|
|
if: success()
|
|
run: |
|
|
git config --global user.name "github-actions[bot]"
|
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
git checkout --orphan latest
|
|
git rm -rf .
|
|
cp -r latest/* .
|
|
git add FunGame.Core.dll FunGame.Core.xml FunGame.Core.deps.json
|
|
git commit -m "Update latest branch with build outputs"
|
|
git push --force origin latest
|