-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (50 loc) · 1.85 KB
/
main.yml
File metadata and controls
67 lines (50 loc) · 1.85 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
67
name: Publish EFCore.PostgresExtensions To NuGet
env:
NUGET_SOURCE: https://api.nuget.org/v3/index.json
OUTPUT_DIR: nupkgs
on:
push:
branches: [ main ]
permissions:
contents: read
jobs:
publish:
runs-on: ubuntu-latest
environment: Environment Settings
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Test
run: dotnet test --no-build --configuration Release --verbosity normal
- name: Pack
run: dotnet pack src/EFCore.PostgresExtensions/EFCore.PostgresExtensions.csproj --no-build --configuration Release --output ${{ env.OUTPUT_DIR }}
- name: Publish packages
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
shell: bash
run: |
set -euo pipefail
if [ -z "${NUGET_API_KEY:-}" ]; then
echo "NUGET_API_KEY is missing. If you stored it as an Environment secret, set jobs.publish.environment to that Environment name."
exit 1
fi
shopt -s nullglob
nupkgs=( "${{ env.OUTPUT_DIR }}"/*.nupkg )
snupkgs=( "${{ env.OUTPUT_DIR }}"/*.snupkg )
if [ ${#nupkgs[@]} -eq 0 ]; then
echo "No .nupkg files found in ${{ env.OUTPUT_DIR }}"
ls -la "${{ env.OUTPUT_DIR }}" || true
exit 1
fi
dotnet nuget push "${nupkgs[@]}" --api-key "$NUGET_API_KEY" --source "${{ env.NUGET_SOURCE }}" --skip-duplicate
if [ ${#snupkgs[@]} -gt 0 ]; then
dotnet nuget push "${snupkgs[@]}" --api-key "$NUGET_API_KEY" --source "${{ env.NUGET_SOURCE }}" --skip-duplicate
fi