-
Notifications
You must be signed in to change notification settings - Fork 3
74 lines (74 loc) · 2.43 KB
/
package.navigator.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
name: Build & Publish - Navigator
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types:
- published
env:
# Stop wasting time caching packages
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending usage data to Microsoft
DOTNET_CLI_TELEMETRY_OPTOUT: true
# Project name to pack and publish
PROJECT_NAME: Navigator
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v3
- name: Restore
working-directory: ./src
run: dotnet restore
- name: Build
working-directory: ./src
run: dotnet build -c Release --no-restore
- name: Test
working-directory: ./src
run: dotnet test -c Release
# - name: Pack
# run: dotnet pack -v normal -c Release --no-restore --include-symbols --include-source -p:PackageVersion=$GITHUB_RUN_ID src/$PROJECT_NAME.sln
# - name: Upload Artifact
# if: matrix.os == 'ubuntu-latest'
# uses: actions/upload-artifact@v2
# with:
# name: nupkg
# path: ./src/${{ env.PROJECT_NAME }}/bin/Release/*.nupkg
publish:
needs: build
if: github.event_name == 'release'
env:
# GitHub Packages Feed settings
GITHUB_FEED: https://nuget.pkg.github.com/navigatorframework/
GITHUB_USER: navigatorframeworkbot
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Official NuGet Feed settings
NUGET_FEED: https://api.nuget.org/v3/index.json
NUGET_KEY: ${{ secrets.NUGET_KEY }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v3
- name: Create release NuGet package
run: |
arrTag=(${GITHUB_REF//\// })
VERSION="${arrTag[2]}"
echo Version: $VERSION
VERSION="${VERSION//v}"
echo Clean Version: $VERSION
dotnet pack -v normal -c Release --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg src/$PROJECT_NAME.sln
- name: Push to GitHub Feed
run: |
for f in ./nupkg/*.nupkg
do
curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED
done
- name: Push to NuGet Feed
run: dotnet nuget push ./nupkg/*.nupkg --source $NUGET_FEED --skip-duplicate --api-key $NUGET_KEY