-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathentrypoint.sh
executable file
·35 lines (28 loc) · 1.01 KB
/
entrypoint.sh
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
#!/bin/bash
# set commit author
git config user.name "Automated"
git config user.email "[email protected]"
git config --global --add safe.directory /github/workspace
# fetch ordered list of image tags
pixelcrane ls "${INPUT_IMAGE}" > /tmp/images.txt
# iterate tags not present in images.txt and extract
while IFS= read -r line; do
image=$(echo $line | cut -d ' ' -f1)
date=$(echo $line | cut -d ' ' -f2)
tag=$(echo "${image}" | cut -d ':' -f 2)
if git rev-parse -q --verify "refs/tags/$tag" >/dev/null; then
echo "Found tag: $tag, skipping"
continue
fi
# extract filtered fs to specified dir
echo "Extracting ${image}"
rm -rf "${INPUT_OUTPUT}"
mkdir -p "${INPUT_OUTPUT}"
pixelcrane extract "${image}" "${INPUT_FILTER}" | tar -xv -C "${INPUT_OUTPUT}"
# commit
git add "${INPUT_OUTPUT}"
env GIT_AUTHOR_DATE="${date}" GIT_COMMITTER_DATE="${date}" git commit -m "${image}"
git tag "${tag}"
done < /tmp/images.txt
# push
git push origin main --tags