Repository navigation
Expand file tree
/
Copy pathcreate_bundle.sh
More file actions
90 lines (71 loc) · 2.11 KB
/
Copy pathcreate_bundle.sh
File metadata and controls
90 lines (71 loc) · 2.11 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
#!/bin/bash
set -euo pipefail
if [ -z "${1:-}" ]; then
echo "Usage: $0 <version>"
exit 1
fi
VERSION="$1"
BASE="io/github/andrewquijano/ciphercraft/$VERSION"
# Clean previous staging artifacts
rm -rf "$BASE"
rm -f bundle.zip
mkdir -p "$BASE"
# Expected artifacts
JAR="build/libs/ciphercraft-$VERSION.jar"
JAVADOC="build/libs/ciphercraft-$VERSION-javadoc.jar"
SOURCES="build/libs/ciphercraft-$VERSION-sources.jar"
POM="build/publications/mavenJava/pom-default.xml"
# Expected signatures
JAR_SIG="$JAR.asc"
JAVADOC_SIG="$JAVADOC.asc"
SOURCES_SIG="$SOURCES.asc"
POM_SIG="$POM.asc"
# Verify all artifacts and signatures exist
echo "Validating Maven Central artifacts..."
for file in \
"$JAR" \
"$JAVADOC" \
"$SOURCES" \
"$POM" \
"$JAR_SIG" \
"$JAVADOC_SIG" \
"$SOURCES_SIG" \
"$POM_SIG"; do
if [ ! -f "$file" ]; then
echo "ERROR: Expected artifact or signature does not exist: $file"
echo "Check Gradle signing and the VERSION variable."
exit 1
fi
echo "Found: $file"
done
# Copy JARs and their signatures
for file in "$JAR" "$JAVADOC" "$SOURCES"; do
cp "$file" "$BASE/"
cp "${file}.asc" "$BASE/"
done
# Copy POM and its signature
cp "$POM" "$BASE/ciphercraft-$VERSION.pom"
cp "$POM_SIG" "$BASE/ciphercraft-$VERSION.pom.asc"
# Generate checksums for artifacts (not signatures)
for file in "$BASE"/*; do
echo "Processing file: $file"
if [[ -f "$file" && ! "$file" =~ \.asc$ ]]; then
echo "Generating hashes for: $file"
sha1sum "$file" | awk '{print $1}' > "${file}.sha1"
md5sum "$file" | awk '{print $1}' > "${file}.md5"
else
echo "Skipping signature file: $file"
fi
done
# Verify that all four signatures were copied
echo "Verifying packaged signatures..."
SIGNATURE_COUNT=$(find "$BASE" -maxdepth 1 -type f -name '*.asc' | wc -l)
if [ "$SIGNATURE_COUNT" -ne 4 ]; then
echo "ERROR: Expected 4 signatures, found $SIGNATURE_COUNT"
exit 1
fi
echo "All 4 GPG signatures are present."
# Create Maven Central deployment bundle
zip -r bundle.zip io
echo ""
echo "Maven Central bundle created successfully: bundle.zip"