Skip to content

Commit 7a7b415

Browse files
committed
Added github workflows
1 parent f4a448d commit 7a7b415

File tree

4 files changed

+102
-0
lines changed

4 files changed

+102
-0
lines changed

.github/scripts/deploy-package.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
cd source/$1
3+
4+
dotnet pack -c release /p:PackageVersion=$GITHUB_REF_NAME --no-restore -o .
5+
6+
dotnet nuget push *.nupkg -k $NUGET_API_KEY -s https://api.nuget.org/v3/index.json

.github/scripts/deploy-packages.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
chmod +x ./.github/scripts/deploy-package.sh
3+
4+
echo Started deploy.
5+
6+
for dir in source/*/
7+
do
8+
dir=${dir%*/}
9+
10+
echo Deploying package: ${dir##*/}
11+
12+
exec ./.github/scripts/deploy-package.sh ${dir##*/} &
13+
wait
14+
done
15+
16+
echo Finished deploy.
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build & Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- '.github/workflows/build-and-tests.yaml'
9+
- 'source/**'
10+
- 'tests/**'
11+
pull_request:
12+
branches:
13+
- main
14+
paths:
15+
- '.github/workflows/build-and-tests.yaml'
16+
- 'source/**'
17+
- 'tests/**'
18+
19+
jobs:
20+
21+
build:
22+
23+
name: Build & Tests
24+
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
29+
- uses: actions/checkout@v4
30+
31+
- name: Setup dotnet
32+
uses: actions/setup-dotnet@v4
33+
with:
34+
dotnet-version: '8.x.x'
35+
36+
- name: Setup Docker
37+
uses: docker/[email protected]
38+
39+
- name: Cache
40+
uses: actions/cache@v3
41+
with:
42+
path: ~/.nuget/packages
43+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
44+
restore-keys: |
45+
${{ runner.os }}-nuget
46+
47+
- name: Install dependencies
48+
run: dotnet restore
49+
50+
- name: Build
51+
run: dotnet build --no-restore --configuration Release
52+
53+
- name: Test
54+
run: dotnet test --no-restore --configuration Release
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Deployment of packages
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build:
9+
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Setup .NET SDK
17+
uses: actions/setup-dotnet@v4
18+
19+
- name: Build
20+
run: dotnet build -c Release
21+
22+
- name: Publish NuGet packacges
23+
env:
24+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
25+
run: chmod +x ./.github/scripts/deploy-packages.sh && ./.github/scripts/deploy-packages.sh
26+
shell: bash

0 commit comments

Comments
 (0)