Skip to content

Commit b2f72b5

Browse files
authored
Create dotnet.yml
1 parent ebacfa0 commit b2f72b5

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

.github/workflows/dotnet.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: .NET
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
create:
7+
tags:
8+
- '*.*.*'
9+
pull_request:
10+
branches: [ master ]
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Setup .NET
17+
uses: actions/setup-dotnet@v1
18+
with:
19+
dotnet-version: 5.0.x
20+
21+
- name: Check Tag
22+
id: check-tag
23+
run: |
24+
if [[ ${{ github.event.ref }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
25+
echo ::set-output name=match::true
26+
fi
27+
28+
- name: Run Unit Tests
29+
run: |
30+
dotnet restore
31+
dotnet build
32+
dotnet test test/NosCore.PathFinder.Tests -v m
33+
34+
- name: Build Artifact
35+
if: steps.check-tag.outputs.match == 'true'
36+
id: build_artifact
37+
run: |
38+
dotnet restore
39+
dotnet build -c Release
40+
dotnet pack -c Release -o /tmp/nupkgs -v m -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
41+
dotnet nuget push /tmp/nupkgs/NosCore.PathFinder.${{github.event.ref}}.nupkg -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json
42+
echo ::set-output name=ARTIFACT_PATH::/tmp/nupkgs/NosCore.PathFinder.${{github.event.ref}}.nupkg
43+
echo ::set-output name=ARTIFACT_NAME::NosCore.PathFinder.${{github.event.ref}}.nupkg
44+
45+
- name: Gets Latest Release
46+
if: steps.check-tag.outputs.match == 'true'
47+
id: latest_release_info
48+
uses: jossef/action-latest-release-info@v1.1.0
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
51+
52+
- name: Upload Release Asset
53+
if: steps.check-tag.outputs.match == 'true'
54+
uses: actions/upload-release-asset@v1
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
57+
with:
58+
upload_url: ${{ steps.latest_release_info.outputs.upload_url }}
59+
asset_path: ${{ steps.build_artifact.outputs.ARTIFACT_PATH }}
60+
asset_name: ${{ steps.build_artifact.outputs.ARTIFACT_NAME }}
61+
asset_content_type: application/zip

0 commit comments

Comments
 (0)