ci: package exact std-text source candidates without a second bundle
This commit was merged in pull request #13.
This commit is contained in:
1 parent
7db401a836
commit
a031fedb73
3 files changed
+51
-3
No files matched your search
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
# Build a repeatable source archive from this component's clean Git commit.
|
||||
set -eu
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "usage: scripts/package.sh OUTPUT_DIRECTORY" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||||
source=$(git -C "$root" rev-parse --verify HEAD)
|
||||
if [ -n "$(git -C "$root" status --porcelain)" ]; then
|
||||
echo "package: source checkout has uncommitted changes" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
output=$(realpath -m -- "$1")
|
||||
case "$output/" in
|
||||
"$root/"*) echo "package: use an output directory outside the source checkout" >&2; exit 2 ;;
|
||||
esac
|
||||
mkdir -p -- "$output"
|
||||
work=$(mktemp -d "$output/.std-text.XXXXXX")
|
||||
trap 'rm -rf -- "$work"' EXIT
|
||||
|
||||
name="marqdo-std-text-$source"
|
||||
archive="$name-source.tar.gz"
|
||||
# Keep the operations separate so a failed git archive cannot be masked by gzip.
|
||||
git -C "$root" archive --format=tar --prefix="$name/" "$source" > "$work/source.tar"
|
||||
gzip -n < "$work/source.tar" > "$work/$archive"
|
||||
(cd "$work" && sha256sum "$archive" > "$archive.sha256")
|
||||
mv -- "$work/$archive" "$work/$archive.sha256" "$output/"
|
||||
printf '%s\n' "$output/$archive"
|
||||
Reference in new issue
Block a user