-
Notifications
You must be signed in to change notification settings - Fork 2
170 lines (150 loc) · 5.28 KB
/
Copy pathpublish-artifacts.yml
File metadata and controls
170 lines (150 loc) · 5.28 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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: Publish Artifacts
on:
workflow_dispatch:
inputs:
package_version:
description: "Optional shared package version."
required: false
type: string
core_version:
description: "Optional manual version for ModularityKit.Mutator."
required: false
type: string
governance_version:
description: "Optional manual version for ModularityKit.Mutator.Governance."
required: false
type: string
redis_version:
description: "Optional manual version for ModularityKit.Mutator.Governance.Redis."
required: false
type: string
publish_core:
description: "Pack ModularityKit.Mutator."
required: false
type: boolean
default: true
publish_governance:
description: "Pack ModularityKit.Mutator.Governance."
required: false
type: boolean
default: true
publish_redis:
description: "Pack ModularityKit.Mutator.Governance.Redis."
required: false
type: boolean
default: true
workflow_call:
inputs:
package_version:
description: "Optional package version, usually the release tag without the leading v."
required: false
type: string
core_version:
description: "Optional manual version for ModularityKit.Mutator."
required: false
type: string
governance_version:
description: "Optional manual version for ModularityKit.Mutator.Governance."
required: false
type: string
redis_version:
description: "Optional manual version for ModularityKit.Mutator.Governance.Redis."
required: false
type: string
publish_core:
description: "Pack ModularityKit.Mutator."
required: false
type: boolean
default: true
publish_governance:
description: "Pack ModularityKit.Mutator.Governance."
required: false
type: boolean
default: true
publish_redis:
description: "Pack ModularityKit.Mutator.Governance.Redis."
required: false
type: boolean
default: true
permissions:
contents: read
jobs:
package:
name: Pack packages
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Restore
run: dotnet restore ModularityKit.Mutator.slnx
- name: Resolve package versions
id: version
env:
PACKAGE_VERSION: ${{ inputs.package_version }}
CORE_VERSION: ${{ inputs.core_version }}
GOVERNANCE_VERSION: ${{ inputs.governance_version }}
REDIS_VERSION: ${{ inputs.redis_version }}
run: |
resolve_version() {
local value="$1"
local fallback="$2"
if [ -z "$value" ]; then
value="$fallback"
fi
if [ -z "$value" ]; then
echo "Missing package version input. Pass a release tag version explicitly." >&2
exit 1
fi
value="${value#v}"
if ! printf '%s' "$value" | grep -Eq '^[0-9]+(\.[0-9]+){1,2}([-+][0-9A-Za-z.-]+)?$'; then
echo "Invalid package version: $value" >&2
exit 1
fi
printf '%s' "$value"
}
shared_version="$(resolve_version "$PACKAGE_VERSION" "")"
core_version="$(resolve_version "$CORE_VERSION" "$shared_version")"
governance_version="$(resolve_version "$GOVERNANCE_VERSION" "$shared_version")"
redis_version="$(resolve_version "$REDIS_VERSION" "$shared_version")"
echo "package_version=$shared_version" >> "$GITHUB_OUTPUT"
echo "core_version=$core_version" >> "$GITHUB_OUTPUT"
echo "governance_version=$governance_version" >> "$GITHUB_OUTPUT"
echo "redis_version=$redis_version" >> "$GITHUB_OUTPUT"
- name: Validate package selection
if: ${{ inputs.publish_core != true && inputs.publish_governance != true && inputs.publish_redis != true }}
run: |
echo "At least one package must be selected for packing." >&2
exit 1
- name: Pack core package
if: ${{ inputs.publish_core == true }}
run: >
dotnet pack src/ModularityKit.Mutator.csproj
-c Release
--no-restore
-o nupkg
-p:PackageVersion=${{ steps.version.outputs.core_version }}
- name: Pack governance package
if: ${{ inputs.publish_governance == true }}
run: >
dotnet pack src/ModularityKit.Mutator.Governance.csproj
-c Release
--no-restore
-o nupkg
-p:PackageVersion=${{ steps.version.outputs.governance_version }}
- name: Pack Redis governance package
if: ${{ inputs.publish_redis == true }}
run: >
dotnet pack src/Redis/ModularityKit.Mutator.Governance.Redis.csproj
-c Release
--no-restore
-o nupkg
-p:PackageVersion=${{ steps.version.outputs.redis_version }}
- name: Upload packages
uses: actions/upload-artifact@v4
with:
name: ModularityKit-packages
path: nupkg/*.nupkg