-
Notifications
You must be signed in to change notification settings - Fork 2
57 lines (53 loc) · 1.62 KB
/
deploy-nuget.yml
File metadata and controls
57 lines (53 loc) · 1.62 KB
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 and Deploy to Nuget
on:
push:
branches: [ main, dev ]
env:
NUGET_API_URL: https://api.nuget.org/v3/index.json
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Pack
run: |
BRANCH="${GITHUB_REF##*/}"
COMMIT_SHORT_SHA=`git rev-parse --short ${GITHUB_SHA}`
COMMIT_COUNT=`git rev-list --count HEAD`
COMMIT_TIME=`git show -s --format=%ct HEAD`
if [ "$BRANCH" = "main" ]; then
dotnet pack --no-dependencies -c Release
else
dotnet pack --no-dependencies -c Debug --version-suffix ${BRANCH}.${COMMIT_TIME}+${COMMIT_SHORT_SHA}
fi
- name: Find Package
run: |
mkdir -p ./packages
find ** -type f -regex '.*\.s?nupkg' -exec mv {} ./packages/ \;
- uses: actions/upload-artifact@v2
with:
name: packages
path: ./packages
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/download-artifact@v2
with:
name: packages
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Push packages
run: find ** -type f -regex '.*\.s?nupkg' -exec dotnet nuget push -s ${{ env.NUGET_API_URL }} -k ${{ secrets.NUGET_API_KEY }} --skip-duplicate {} \;