-
Notifications
You must be signed in to change notification settings - Fork 27
52 lines (43 loc) · 1.72 KB
/
build-and-publish-on-push.yaml
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
name: Build and publish NuGet packages
on:
push:
branches:
- feature/dotnet-core
pull_request:
branches:
- feature/dotnet-core
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install .NET Core SDK
uses: actions/setup-dotnet@v2
with:
dotnet-version: '8.0.x'
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
- name: Restore required NuGet packages
run: dotnet restore
working-directory: src
- name: Build
run: dotnet build --configuration Release --no-restore -p:BuildNumber=$GITHUB_RUN_NUMBER -p:ContinuousIntegrationBuild=true
working-directory: src
- name: Create NuGet packages
if: github.ref == 'refs/heads/feature/dotnet-core' # only publish on pushes, not on PRs
run: dotnet pack --configuration Release --no-build --output ../packages -p:BuildNumber=$GITHUB_RUN_NUMBER -p:ContinuousIntegrationBuild=true
working-directory: src
- name: Upload NuGet packages as artifacts
if: github.ref == 'refs/heads/feature/dotnet-core' # only publish on pushes, not on PRs
uses: actions/upload-artifact@v1
with:
name: NuGet_Packages
path: packages
- name: Publish NuGet packages to GitHub package registry
if: github.ref == 'refs/heads/feature/dotnet-core' # only publish on pushes, not on PRs
run: dotnet nuget push ./packages/**/*.nupkg --skip-duplicate --source $NUGET_SOURCE --api-key $NUGET_API_KEY
env:
NUGET_SOURCE: https://nuget.pkg.github.com/thinktecture/index.json
NUGET_API_KEY: ${{secrets.GITHUB_TOKEN}}