-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (100 loc) · 4.19 KB
/
Copy pathgithub.yml
File metadata and controls
114 lines (100 loc) · 4.19 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
on:
workflow_call:
inputs:
release-info:
type: string
required: true
jobs:
push:
if: ${{ fromJSON(inputs.release-info).releases_created == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Resolve prior plugin DLLs
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_INFO: ${{ inputs.release-info }}
shell: bash
run: |
set -euo pipefail
mkdir -p artifacts
declare -A SKIPPED
mapfile -t plugins < <(jq -r '.plugins[] | "\(.component)|\(.slug).dll|\(.path)--release_created"' .github/plugin-manifest.json)
for entry in "${plugins[@]}"; do
IFS='|' read -r component dll key <<< "$entry"
released=$(echo "$RELEASE_INFO" | jq -r --arg k "$key" '.[$k] // "false"')
if [ "$released" = "true" ]; then
echo "::notice::$component released this run — using freshly built $dll"
continue
fi
if [ -f "artifacts/$dll" ]; then
echo "::notice::Trusting pre-existing $dll in artifacts/"
continue
fi
releases_json=$(gh release list --limit 200 --json tagName,createdAt 2>&1) || {
echo "::error::gh release list failed for $component: $releases_json"
exit 1
}
latest_tag=$(echo "$releases_json" | jq -r \
--arg c "$component" \
'[.[] | select(.tagName | test("^" + $c + "-v[0-9]+\\.[0-9]+\\.[0-9]+$"))] | sort_by(.createdAt) | reverse | .[0].tagName' \
2>/dev/null || echo "null")
if [ -z "$latest_tag" ] || [ "$latest_tag" = "null" ]; then
echo "::warning::No stable prior release found for $component — $dll will be omitted"
SKIPPED[$dll]=1
continue
fi
echo "::notice::Fetching $dll from $latest_tag"
if ! gh release download "$latest_tag" --pattern "$dll" --dir artifacts --clobber 2>&1; then
echo "::warning::Failed to download $dll from $latest_tag — skipping"
SKIPPED[$dll]=1
fi
done
echo "=== Bundle manifest ==="
shopt -s nullglob
for f in artifacts/void-*.dll; do echo " $f"; done
shopt -u nullglob
missing=()
mapfile -t expected_dlls < <(jq -r '.plugins[] | "\(.slug).dll"' .github/plugin-manifest.json)
for dll in "${expected_dlls[@]}"; do
if [ -z "${SKIPPED[$dll]+x}" ] && [ ! -f "artifacts/$dll" ]; then
missing+=("$dll")
fi
done
if [ ${#missing[@]} -gt 0 ]; then
echo "::error::Expected DLLs missing from artifacts: ${missing[*]}"
exit 1
fi
- name: Upload Release bundles
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_INFO: ${{ inputs.release-info }}
shell: bash
run: |
set -euo pipefail
shopt -s nullglob
files=(artifacts/void-*.dll)
if [ ${#files[@]} -eq 0 ]; then
echo "::error::No DLLs found in artifacts/ for bundle upload"
exit 1
fi
while IFS='|' read -r component path slug; do
released=$(jq -r --arg k "${path}--release_created" '.[$k] // "false"' <<<"$RELEASE_INFO")
if [ "$released" != "true" ]; then
echo "::notice::Skipping $component bundle upload (release_created != true)"
continue
fi
tag=$(jq -r --arg k "${path}--tag_name" '.[$k]' <<<"$RELEASE_INFO")
if [ -z "$tag" ] || [ "$tag" = "null" ]; then
echo "::error::Missing tag_name for $component (path=$path)"
exit 1
fi
echo "Uploading ${#files[@]} DLL(s) to $tag ($component)"
gh release upload "$tag" "${files[@]}" --clobber
done < <(jq -r '.plugins[] | "\(.component)|\(.path)|\(.slug)"' .github/plugin-manifest.json)