-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (64 loc) · 2.31 KB
/
ci.yml
File metadata and controls
75 lines (64 loc) · 2.31 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
68
69
70
71
72
73
74
75
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
packages: read
env:
DOTNET_VERSION: '10.0.x'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# ── Read version — skip CI for .dev versions ──────────────────────────
# .dev versions reference local packages (e.g. PayrollEngine.Client.Scripting
# 0.10.0-beta.dev) that are not published to GitHub Packages.
- name: Read version
id: version
working-directory: 'YYYY'
run: |
VERSION=$(grep -oP '(?<=<Version>)[^<]+' Directory.Build.props)
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Version: ${VERSION}"
if [[ "${VERSION}" == *".dev"* ]]; then
echo "is_dev=true" >> $GITHUB_OUTPUT
echo "⏭️ Development version — skipping CI build"
else
echo "is_dev=false" >> $GITHUB_OUTPUT
fi
- name: Setup .NET
if: steps.version.outputs.is_dev != 'true'
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Configure GitHub Packages
if: steps.version.outputs.is_dev != 'true'
run: |
# Remove local dev source (not available in CI)
dotnet nuget remove source PayrollEngine 2>/dev/null || true
dotnet nuget add source \
"https://nuget.pkg.github.com/Payroll-Engine/index.json" \
--name github \
--username github-actions \
--password ${{ secrets.GITHUB_TOKEN }} \
--store-password-in-clear-text
- name: Restore
if: steps.version.outputs.is_dev != 'true'
working-directory: 'YYYY'
run: dotnet restore
- name: Build
if: steps.version.outputs.is_dev != 'true'
working-directory: 'YYYY'
run: dotnet build --configuration Release --no-restore
- name: Pack
if: steps.version.outputs.is_dev != 'true'
working-directory: 'YYYY'
run: dotnet pack --configuration Release --no-build --output ./nupkgs
- name: List packages
if: steps.version.outputs.is_dev != 'true'
working-directory: 'YYYY'
run: ls -la ./nupkgs/