-
Notifications
You must be signed in to change notification settings - Fork 1
84 lines (68 loc) · 2.68 KB
/
dotnetcore.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: .NET Core
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.100
- name: Setup .NET Core 2.2
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.2.402
- name: dotnet version
run: dotnet --version
- name: Run GitVersion
uses: roryprimrose/rungitversion@v1.0.0
with:
# "true" to use GitVersion /nofetch, any other value to enable fetch
nofetch: false
# "true" to use GitVersion /nocache, any other value to enable cache
nocache: false
- name: Build with dotnet
run: dotnet build --configuration Release ./SharpHelpers/SharpHelpers.sln
- name: dotnet test
run: dotnet test ./SharpHelpers/SharpHelpers.sln -c Release --no-build
- name: dotnet pack
run: dotnet pack ./SharpHelpers/SharpHelpers.sln -c Release --no-build
- name: setup nuget
if: github.event_name == 'push' && github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/v')
uses: NuGet/setup-nuget@v1.0.2
with:
nuget-version: latest
- name: add package repository
if: github.event_name == 'push' && github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/v')
run: nuget source Add -Config ./SharpHelpers/SharpHelpers/nuget.config -Name "github" -Source https://nuget.pkg.github.com/sharpcode-it/index.json -UserName iscifoni -Password ${{ secrets.GITHUB_TOKEN }} -StorePasswordInClearText
- name: Publish nuget to GitHub Packages
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
run: |
for f in ./SharpHelpers/SharpHelpers/bin/Release/*.nupkg
do
echo @$f
curl --silent --show-error --fail -vX PUT -u "iscifoni:${{ secrets.GITHUB_TOKEN }}" -F package=@$f https://nuget.pkg.github.com/shaprcode-it/
if [ $? -eq 0 ]
then
echo "successfully pushed $f"
else
echo "failed to push $f" >&2
exit 1
fi
done
shell: bash
- name: push packages (nuget)
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/v')
run: |
for f in ./SharpHelpers/SharpHelpers/bin/Release/*.nupkg
do
nuget push $f -source https://api.nuget.org/v3/index.json -ApiKey ${{ secrets.NUGET_TOKEN }}
if [ $? -eq 0 ]
then
echo "successfully pushed $f"
else
echo "failed to push $f" >&2
exit 1
fi
done