-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (45 loc) · 1.57 KB
/
publish.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
name: Publish Package
on:
push:
branches:
- master
pull_request:
branches:
- master
permissions:
packages: write
contents: read
jobs:
build:
runs-on: [self-hosted, nonroot]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
with:
prefix: CI_
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
6.x
3.1.x
- name: Restore dependencies
run: dotnet restore
- name: Nerdbank.GitVersioning
id: nbgv
uses: dotnet/[email protected]
- name: Build version (master)
if: env.CI_GITHUB_REF_SLUG == 'master'
run: echo "PUBLISH_VERSION=${{ steps.nbgv.outputs.SimpleVersion }}.${{ steps.nbgv.outputs.VersionHeight }}" >> $GITHUB_ENV
- name: Build version (PR)
if: env.CI_GITHUB_REF_SLUG != 'master'
run: echo "PUBLISH_VERSION=${{ steps.nbgv.outputs.SimpleVersion }}.${{ steps.nbgv.outputs.VersionHeight }}-${{ env.CI_GITHUB_HEAD_REF_SLUG }}" >> $GITHUB_ENV
- name: Build
run: dotnet build --configuration Release -p:Version=${{ env.PUBLISH_VERSION }} --no-restore
- name: Pack
run: dotnet pack --configuration Release --no-build -p:PackageVersion=${{ env.PUBLISH_VERSION }}
- name: Push
run: dotnet nuget push **/bin/Release/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/urbansportsclub/index.json --skip-duplicate --no-symbols