-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpush.sh
More file actions
executable file
·103 lines (90 loc) · 3.1 KB
/
push.sh
File metadata and controls
executable file
·103 lines (90 loc) · 3.1 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
#!/usr/bin/env bash
set -euo pipefail
# Add /usr/local/bin to PATH for oras
export PATH="/usr/local/bin:$PATH"
REPO="katasec/dstream-console-output-provider"
# ---------------------------------------------------------------------------
# Work out the tag to push (last git tag by default)
# Allow override via env var, e.g. TAG=v0.1.0 ./push.sh
# ---------------------------------------------------------------------------
TAG="${TAG:-$(git describe --tags --abbrev=0 2>/dev/null || echo 'v0.1.0')}"
TMP_DIR="$(mktemp -d)"
trap 'rm -rf "$TMP_DIR"' EXIT
echo "🔧 Building cross-platform .NET binaries …"
# ---------------------------------------------------------------------------
# Build matrix - .NET runtime identifiers
# ---------------------------------------------------------------------------
targets=(
"linux-x64"
"linux-arm64"
"osx-x64"
"osx-arm64"
"win-x64"
)
for runtime in "${targets[@]}"; do
outfile="provider.${runtime}"
[[ $runtime == win-* ]] && outfile+=".exe"
echo " • $outfile"
/usr/local/share/dotnet/dotnet publish \
--configuration Release \
--runtime "$runtime" \
--self-contained true \
--output "${TMP_DIR}/${runtime}" \
/p:PublishSingleFile=true \
/p:PublishTrimmed=false
# Copy the published binary to standardized name
if [[ $runtime == win-* ]]; then
cp "${TMP_DIR}/${runtime}/console-output-provider.exe" "${TMP_DIR}/${outfile}"
else
cp "${TMP_DIR}/${runtime}/console-output-provider" "${TMP_DIR}/${outfile}"
fi
done
# ---------------------------------------------------------------------------
# Create provider manifest
# ---------------------------------------------------------------------------
cat > "${TMP_DIR}/provider.json" << EOF
{
"name": "dstream-console-output-provider",
"version": "${TAG}",
"description": "DStream console output provider for displaying streaming data",
"type": "output",
"sdk_version": "0.1.1",
"config_schema": {
"outputFormat": {
"type": "string",
"description": "Output format: simple, structured, or json",
"enum": ["simple", "structured", "json"],
"default": "simple"
},
"showMetadata": {
"type": "boolean",
"description": "Whether to display envelope metadata",
"default": false
}
},
"platforms": [
"linux-x64",
"linux-arm64",
"osx-x64",
"osx-arm64",
"win-x64"
]
}
EOF
# ---------------------------------------------------------------------------
# Push as OCI artifact
# ---------------------------------------------------------------------------
cd "$TMP_DIR"
echo "📦 Pushing to ghcr.io/${REPO}:${TAG}"
oras push "ghcr.io/${REPO}:${TAG}" \
--artifact-type "application/vnd.dstream.provider" \
--annotation "org.opencontainers.image.description=DStream console output provider" \
--annotation "org.opencontainers.image.source=https://github.com/katasec/dstream-providers" \
--annotation "org.opencontainers.image.version=${TAG}" \
provider.linux-x64 \
provider.linux-arm64 \
provider.osx-x64 \
provider.osx-arm64 \
provider.win-x64.exe \
provider.json
echo "✅ Provider + manifest pushed: ${TAG}"