-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (57 loc) · 1.66 KB
/
deploy-nuget.yml
File metadata and controls
66 lines (57 loc) · 1.66 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
58
59
60
61
62
63
64
65
66
name: Build and Deploy NuGet Package
on:
push:
branches:
- main
- dev
workflow_dispatch:
inputs:
force:
description: 'Force exec'
type: boolean
required: true
default: false
jobs:
Detect:
runs-on: ubuntu-latest
outputs:
app: ${{ steps.detect.outputs.app }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Detect Change
id: detect
run: |
APP="${GITHUB_REPOSITORY#*/}"
PROJECT_PATH=`find . -type f -iname "*.csproj" | grep -Em1 "${APP}(.API)?.csproj" || true`
if [ ! -z "$PROJECT_PATH" ]; then
APP=`basename "${PROJECT_PATH}" .csproj`
fi
CHANGE_FILES=`git diff --no-commit-id --name-only HEAD^`
CHANGED=`echo "$CHANGE_FILES" | grep -Em 1 '.cs|.proto' || true`
if [ -z "$CHANGED" ] && [ "${{ inputs.force }}" != true ]; then
echo "No changes detected"
APP=""
fi
echo "app=${APP}" >> $GITHUB_OUTPUT
Build:
needs: Detect
if: needs.Detect.outputs.app != ''
runs-on: ubuntu-latest
outputs:
artifact: ${{ steps.build.outputs.artifact }}
steps:
- id: build
name: Build Package
uses: netcorext/dotnet-build-package-action@dev
Deploy:
needs: Build
runs-on: ubuntu-latest
steps:
- uses: netcorext/push-nuget-package-action@dev
name: Push Package
with:
artifact: ${{ needs.Build.outputs.artifact }}
nuget-api-url: ${{ secrets.NUGET_API_URL }}
nuget-api-key: ${{ secrets.NUGET_API_KEY }}