-
-
Notifications
You must be signed in to change notification settings - Fork 244
57 lines (55 loc) · 2.16 KB
/
build.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
name: Build
on: [push, pull_request]
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.300
- name: Build Reason
run: "echo ref: ${{github.ref}} event: ${{github.event_name}}"
- name: Build Version
run: |
dotnet tool install --global minver-cli --version 2.3.0
version=$(minver --tag-prefix v)
echo "::set-env name=MINVERVERSIONOVERRIDE::$version"
- name: Build
run: |
echo $MINVERVERSIONOVERRIDE
dotnet build Foundatio.sln --configuration Release
- name: Run Tests
run: dotnet test Foundatio.sln --configuration Release --no-build
- name: Package
if: github.event_name != 'pull_request'
run: dotnet pack Foundatio.sln --configuration Release --no-build
- name: Publish CI Packages
if: github.event_name != 'pull_request'
run: |
for package in $(find -name "*.nupkg" | grep "minver" -v); do
echo "${0##*/}": Pushing $package...
# GPR - workaround for GPR not working with API key
echo "Pushing $package to GPR..."
STATUSCODE=$(curl -sX --write-out "%{http_code}" PUT -u "foundatiofx:${{ secrets.GITHUB_TOKEN }}" -F package=@$package https://nuget.pkg.github.com/foundatiofx/)
if test $STATUSCODE -ne 200; then
echo "Failed to push"
else
echo "Your package was pushed."
fi
# feedz (remove once GPR supports anonymous access)
dotnet nuget push $package --source https://f.feedz.io/foundatio/foundatio/nuget --api-key ${{ secrets.FEEDZ_KEY }} --skip-duplicate
done
- name: Publish Release Packages
if: startsWith(github.ref, 'refs/tags/v')
run: |
for package in $(find -name "*.nupkg" | grep "minver" -v); do
echo "${0##*/}": Pushing $package...
dotnet nuget push $package --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }} --skip-duplicate
done