Files
yunhai.netcore.tool/BasePlatformDotnet/.gitea/workflows/ci.yml
T
2026-09-02 09:38:45 +08:00

53 lines
1.4 KiB
YAML

name: ci
on:
push:
branches: [main, master]
pull_request:
jobs:
build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore
run: dotnet restore yh-platform-net.sln
- name: Build
run: dotnet build yh-platform-net.sln --no-restore -c Release
- name: Test
run: dotnet test yh-platform-net.sln --no-build -c Release --logger "console;verbosity=normal"
- name: Pack
run: dotnet pack yh-platform-net.sln --no-build -c Release -o artifacts
publish:
# 仅主分支 push 时发版到 Nexus 私服(PR 不触发)
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
needs: build-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Pack
run: dotnet pack yh-platform-net.sln -c Release -o artifacts
- name: Push to Nexus
run: >
dotnet nuget push "artifacts/*.nupkg"
--source ${{ secrets.NEXUS_URL }}
--username ${{ secrets.NEXUS_USER }}
--password "${{ secrets.NEXUS_PASS }}"
--api-key nexus --skip-duplicate