|
1 | 1 | #!/bin/bash |
2 | 2 | set -eux -o pipefail |
3 | 3 | : "Argv0: $0" |
| 4 | +dir="$(dirname "$0")" |
| 5 | +read_action_input() { |
| 6 | + "${dir}/read-action-input" "$1" |
| 7 | +} |
4 | 8 | : "Prepare Timestamp for Layer Cache Busting" |
5 | | -date --iso=ns | tee "$(./read-action-input scratch-dir)"/buildstamp |
| 9 | +date --iso=ns | tee "$(read_action_input scratch-dir)"/buildstamp |
6 | 10 | : "Prepare Dancefile to Access Caches" |
7 | | -cat >"$(./read-action-input scratch-dir)"/Dancefile.extract <<EOF |
| 11 | +cat >"$(read_action_input scratch-dir)"/Dancefile.extract <<EOF |
8 | 12 | FROM busybox:1 |
9 | 13 | COPY buildstamp buildstamp |
10 | | -RUN --mount=type=cache,target="$(./read-action-input cache-target)" \ |
| 14 | +RUN --mount=type=cache,target="$(read_action_input cache-target)" \ |
11 | 15 | mkdir -p /var/dance-cache/ \ |
12 | | - && cp -p -R "$(./read-action-input cache-target)"/. /var/dance-cache/ || true |
| 16 | + && cp -p -R "$(read_action_input cache-target)"/. /var/dance-cache/ || true |
13 | 17 | EOF |
14 | | -cat "$(./read-action-input scratch-dir)"/Dancefile.extract |
| 18 | +cat "$(read_action_input scratch-dir)"/Dancefile.extract |
15 | 19 | : "Extract Data into Docker Image" |
16 | | -docker buildx build -f "$(./read-action-input scratch-dir)"/Dancefile.extract --tag dance:extract --load "$(./read-action-input scratch-dir)" |
| 20 | +docker buildx build -f "$(read_action_input scratch-dir)"/Dancefile.extract --tag dance:extract --load "$(read_action_input scratch-dir)" |
17 | 21 | : "Create Extraction Image" |
18 | 22 | docker rm -f cache-container && docker create -ti --name cache-container dance:extract |
19 | 23 | : "Unpack Docker Image into Scratch" |
20 | | -docker cp -L cache-container:/var/dance-cache - | tar -H posix -x -C "$(./read-action-input scratch-dir)" |
| 24 | +docker cp -L cache-container:/var/dance-cache - | tar -H posix -x -C "$(read_action_input scratch-dir)" |
21 | 25 | : "Move Cache into Its Place" |
22 | | -sudo rm -rf "$(./read-action-input cache-source)" |
23 | | -mv "$(./read-action-input scratch-dir)"/dance-cache "$(./read-action-input cache-source)" |
| 26 | +sudo rm -rf "$(read_action_input cache-source)" |
| 27 | +mv "$(read_action_input scratch-dir)"/dance-cache "$(read_action_input cache-source)" |
0 commit comments