-
Notifications
You must be signed in to change notification settings - Fork 1
111 lines (93 loc) · 3.31 KB
/
Copy pathpublish-artifacts.yml
File metadata and controls
111 lines (93 loc) · 3.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
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
name: Publish Artifacts
on:
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
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 }}
REF_NAME: ${{ github.ref_name }}
run: |
resolve_version() {
local value="$1"
local fallback="$2"
if [ -z "$value" ]; then
value="$fallback"
fi
if [ -z "$value" ]; then
value="$REF_NAME"
fi
value="${value#v}"
if ! printf '%s' "$value" | grep -Eq '^[0-9]+(\.[0-9]+){1,2}([-+][0-9A-Za-z.-]+)?$'; then
value="0.1.0"
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: Pack core package
run: >
dotnet pack src/ModularityKit.Mutator.csproj
-c Release
--no-restore
-o nupkg
-p:PackageVersion=${{ steps.version.outputs.core_version }}
- name: Pack governance package
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
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