Skip to content

Commit c3fc3cb

Browse files
committed
add github actions
1 parent b8380a2 commit c3fc3cb

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

.github/workflows/build.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: build
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Info
11+
run: echo 'Building ${{ github.ref }}'
12+
13+
- uses: actions/checkout@v2
14+
15+
- name: Setup .NET Core
16+
uses: actions/setup-dotnet@v4
17+
with:
18+
dotnet-version: 9.0.100
19+
20+
- name: Start MongoDB
21+
uses: supercharge/[email protected]
22+
with:
23+
mongodb-version: '8.0'
24+
25+
- name: Build & Test
26+
run: make test config=Release
27+
28+
publish:
29+
if: contains(github.ref, 'refs/tags/')
30+
needs: build
31+
runs-on: ubuntu-latest
32+
33+
steps:
34+
- name: Info
35+
run: echo 'Building ${{ github.ref }}'
36+
37+
- uses: actions/checkout@v1
38+
39+
- name: Setup .NET Core
40+
uses: actions/setup-dotnet@v4
41+
with:
42+
dotnet-version: 9.0.100
43+
44+
- name: Build nuget
45+
run: make nuget config=Release version=${GITHUB_REF#refs/tags/}
46+
47+
- name: publish nuget
48+
run: make publish nugetkey=${{secrets.NUGET_KEY}}

Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
config ?= Debug
2+
version ?= 0.0.0
3+
4+
5+
build:
6+
dotnet build
7+
8+
test:
9+
dotnet test
10+
11+
nuget:
12+
dotnet pack -c $(config) -p:Version=$(version) -o .out
13+
14+
publish: .out/*.nupkg
15+
@for file in $^ ; do \
16+
dotnet nuget push $$file -k $(nugetkey) -s https://api.nuget.org/v3/index.json --skip-duplicate ; \
17+
done

0 commit comments

Comments
 (0)