Skip to content

Commit 8e5ab63

Browse files
Add github workflows to create a NuGet
1 parent 288b27c commit 8e5ab63

2 files changed

Lines changed: 62 additions & 0 deletions

File tree

.github/workflows/build-deploy.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: build and test
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Setup .NET
17+
uses: actions/setup-dotnet@v1
18+
with:
19+
dotnet-version: 6.0.x
20+
- name: Restore dependencies
21+
run: dotnet restore
22+
- name: Build
23+
run: dotnet build --configuration Release --no-restore
24+
- name: Test
25+
run: dotnet test --configuration Release --no-build --verbosity normal

.github/workflows/release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: build, test, pack and push
2+
3+
on:
4+
push:
5+
tags:
6+
- '**'
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Setup .NET
16+
uses: actions/setup-dotnet@v1
17+
with:
18+
dotnet-version: 6.0.x
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
with:
22+
fetch-depth: 0
23+
- name: Get the version
24+
id: get_version
25+
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
26+
- name: Restore dependencies
27+
run: dotnet restore
28+
- name: Build
29+
run: dotnet build --configuration Release --no-restore
30+
- name: Test
31+
run: dotnet test --configuration Release --no-build --verbosity normal
32+
- name: Package nuget
33+
run: dotnet pack ./src/CromulentBisgetti.ContainerPacking/CromulentBisgetti.ContainerPacking.csproj --configuration release -o:package /p:PackageVersion=${{ steps.get_version.outputs.VERSION }}
34+
- name: Push generated package to GitHub registry
35+
run: dotnet nuget push ./package/*.nupkg --source "https://nuget.pkg.github.com/DigitecGalaxus/index.json" --api-key ${{ github.token }}
36+
- name: Push generated package to nuget registry
37+
run: dotnet nuget push ./package/*.nupkg --source "https://api.nuget.org/v3/index.json" -k ${{ secrets.NUGET_API_KEY }}

0 commit comments

Comments
 (0)