Update dotnet.yml #87
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 Build Workflow | ||
on: | ||
push: | ||
branches: [ "dev", "master" ] | ||
pull_request: | ||
branches: [ "dev", "master" ] | ||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- branch: dev | ||
os: ubuntu-latest | ||
platform: "linux-x64" | ||
- branch: master | ||
os: windows-latest | ||
platform: "win-x64" | ||
- branch: master | ||
os: ubuntu-latest | ||
platform: "linux-x64" | ||
runs-on: ${{ matrix.os }} | ||
# 只有当当前分支与 matrix 中的 branch 匹配时才运行 job | ||
if: contains(matrix.branch, github.ref_name) | ||
Check failure on line 28 in .github/workflows/dotnet.yml GitHub Actions / .NET Build WorkflowInvalid workflow file
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v3 | ||
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: Publish for ${{ matrix.platform }} | ||
run: | | ||
mkdir pub | ||
dotnet publish -c Release -r ${{ matrix.platform }} InfrastSimExports | ||
cp InfrastSimExports/bin/Release/net8.0/${{ matrix.platform }}/publish/InfrastSimExports.* pub/ | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.platform }} | ||
path: pub/* |