-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (84 loc) · 2.58 KB
/
Copy pathbuild.yml
File metadata and controls
94 lines (84 loc) · 2.58 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Reusable workflow for building the solution.
#
# This workflow is designed to be called by other workflows to avoid
# redundant compilation. It builds the solution and uploads the build
# artifacts for downstream jobs to consume.
#
# Usage in other workflows:
# jobs:
# build:
# uses: ./.github/workflows/build.yml
# with:
# configuration: Release
#
# dependent-job:
# needs: build
# steps:
# - uses: actions/download-artifact@v4
# with:
# name: build-output-Release
name: Build
on:
# Allow this workflow to be called by other workflows
workflow_call:
inputs:
configuration:
description: 'Build configuration (Debug or Release)'
required: false
default: 'Debug'
type: string
upload_artifacts:
description: 'Whether to upload build artifacts'
required: false
default: true
type: boolean
# Also allow standalone execution for testing
workflow_dispatch:
inputs:
configuration:
description: 'Build configuration'
required: false
default: 'Debug'
type: choice
options:
- Debug
- Release
# Restrict default permissions for security
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for version calculation
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x
- name: Restore dependencies
run: dotnet restore Smtp2Go.NET.slnx
- name: Build solution
# Build the entire solution with the specified configuration
run: dotnet build Smtp2Go.NET.slnx --configuration ${{ inputs.configuration }} --no-restore
- name: Upload build artifacts
# Upload the build output for downstream jobs to consume
# This avoids the need to rebuild in dependent workflows
if: ${{ inputs.upload_artifacts }}
uses: actions/upload-artifact@v4
with:
name: build-output-${{ inputs.configuration }}
path: |
src/**/bin/${{ inputs.configuration }}
src/**/obj/${{ inputs.configuration }}
tests/**/bin/${{ inputs.configuration }}
tests/**/obj/${{ inputs.configuration }}
samples/**/bin/${{ inputs.configuration }}
samples/**/obj/${{ inputs.configuration }}
retention-days: 1