Skip to content

⬆️(deps): Bump dotnet-coverage from 17.12.6 to 17.13.1 #657

⬆️(deps): Bump dotnet-coverage from 17.12.6 to 17.13.1

⬆️(deps): Bump dotnet-coverage from 17.12.6 to 17.13.1 #657

Workflow file for this run

name: Build
on:
push:
branches:
- master
- develop
paths:
- .github/workflows/build.yml
- .config/dotnet-tools.json
- global.json
- nuget.config
- Shimakaze.Sdk.sln
- Directory.Build.props
- Directory.Build.targets
- Directory.Packages.props
- "app/**/*"
- "lib/**/*"
- "msbuild/**/*"
- "src/**/*"
- "test/**/*"
pull_request:
branches:
- master
- develop
paths:
- .github/workflows/build.yml
- .config/dotnet-tools.json
- global.json
- nuget.config
- Shimakaze.Sdk.sln
- Directory.Build.props
- Directory.Build.targets
- Directory.Packages.props
- "app/**/*"
- "lib/**/*"
- "msbuild/**/*"
- "src/**/*"
- "test/**/*"
merge_group:
jobs:
build-dotnet:
name: .Net 构建
runs-on: windows-latest
steps:
- name: 签出仓库
uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0
- name: 配置 .Net 环境
uses: actions/setup-dotnet@v4.1.0
with:
global-json-file: ./global.json
cache: false
- name: 还原本地工具
run: dotnet tool restore
- name: 还原
run: dotnet restore --graph --artifacts-path artifacts
- name: 生成
run: dotnet build --graph --artifacts-path artifacts --configuration Release --no-restore
- name: 测试
shell: pwsh
run: dotnet coverage collect --output-format coverage dotnet test --graph --artifacts-path artifacts --configuration Release --no-restore --no-build
- name: 打包
run: dotnet pack --graph --artifacts-path artifacts --configuration Release --no-restore --no-build --include-symbols --include-source
- name: 生成校验和
shell: pwsh
run: |
$Private:Algorithm = 'SHA256'
Write-Output "### Build Success :rocket: >> $env:GITHUB_STEP_SUMMARY
Write-Output "|FileName|$Private:Algorithm|" >> $env:GITHUB_STEP_SUMMARY
Write-Output "|:-|:-:|" >> $env:GITHUB_STEP_SUMMARY
Get-ChildItem artifacts\package\release | ForEach-Object {
$Private:Name = $PSItem.Name
$Private:FileHashResult = Get-FileHash $PSItem -Algorithm $Private:Algorithm
$Private:FileHash = $Private:FileHashResult.Hash
Write-Output "|$Private:Name|$Private:FileHash|" >> $env:GITHUB_STEP_SUMMARY
}
- name: 收集 Nuget 包
uses: actions/upload-artifact@v4.4.3
with:
name: nuget-packages
path: |
artifacts\package\release\*
retention-days: 3
- name: 上传测试覆盖率
uses: coverallsapp/github-action@v2
continue-on-error: true
with:
file: .\output.coverage
release:
needs: build-dotnet
name: 发布
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
discussions: write
runs-on: ubuntu-latest
steps:
- name: Download a Build Artifact
uses: actions/download-artifact@v4.1.8
with:
name: nuget-packages-windows-latest
path: artifact
- name: Release
uses: softprops/action-gh-release@v2
with:
files: artifact/*
- name: 推送 Nuget 包
shell: pwsh
continue-on-error: true
env:
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}
run: |
Set-Location nupkg
dotnet nuget push *.nupkg -s nuget -k $env:NUGET_TOKEN --skip-duplicate
Set-Location ..