aboutsummaryrefslogtreecommitdiff
path: root/maint/preserve
blob: ac349fd5f58b179a0d4f520b28ca2bad6f6b7c0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env sh

# This script is meant to preserve and restore CI artifacts so they can be passed from job to job.
# See arti!786 for why it is done this way, and what could be done better.

set -eu

PREFIX="artifacts"

if [ "$1" = "-u" ]; then
	mv "$PREFIX/"* .
	exit 0
else
	for path in "$@"
	do
		DIR=$(dirname "$path")
		mkdir -p "$PREFIX/$DIR"
		cp -al "$path" "$PREFIX/$path"
	done
fi