Merge pull request #28 from huhouhua/dev #76
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: DotNet | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
release: | |
types: [published] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
name: Test | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- uses: actions/cache@v2 | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-nuget- | |
- name: Setup dotnet 3.1 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '3.1' | |
- name: Setup dotnet 5 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '5.0' | |
- name: Setup dotnet 6 | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '6.0' | |
- run: dotnet tool install -g Codecov.Tool | |
- run: dotnet tool install -g GitVersion.Tool | |
- name: GitVersion | |
run: dotnet gitversion /l console /output buildserver | |
- run: ./build.ps1 | |
shell: pwsh | |
- run: ./test.ps1 | |
shell: pwsh | |
- name: Push NuGet | |
if: | | |
startsWith(github.event.ref, 'refs/tags/') | |
|| endsWith(github.event.ref, '/master') | |
|| github.event.action == 'published' | |
shell: pwsh | |
run: dotnet nuget push **/*.nupkg --source $Env:SOURCE --api-key $Env:TOKEN --skip-duplicate | |
env: | |
SOURCE: 'https://api.nuget.org/v3/index.json' | |
TOKEN: ${{ secrets.NUGET_API_KEY }} |