diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8616179..5c4e08a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,6 +36,7 @@ jobs: with: cache-source: var-lib-apt cache-target: /var/lib/apt + cache-id: cache-var-lib-apt skip-extraction: ${{ steps.cache-var-lib-apt.outputs.cache-hit }} - name: Build and push uses: docker/build-push-action@v5 diff --git a/.github/workflows/test/Dockerfile b/.github/workflows/test/Dockerfile index 728b80b..0889316 100644 --- a/.github/workflows/test/Dockerfile +++ b/.github/workflows/test/Dockerfile @@ -3,6 +3,6 @@ RUN rm -f /etc/apt/apt.conf.d/docker-clean && \ echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache RUN \ --mount=type=cache,target=/var/cache/apt,sharing=locked \ - --mount=type=cache,target=/var/lib/apt,sharing=locked \ + --mount=type=cache,id=cache-var-lib-apt,target=/var/lib/apt,sharing=locked \ apt update && \ apt-get --no-install-recommends install -y gcc diff --git a/action.yml b/action.yml index 23344c0..f441278 100644 --- a/action.yml +++ b/action.yml @@ -7,6 +7,9 @@ inputs: cache-target: default: /root/.cache/go-build description: "Where the cache is stored in the docker container. Default: `/root/.cache/go-build`" + cache-id: + default: '' + description: "The id of the cache mount. Default: '' (No id)" scratch-dir: default: scratch description: "Where the action is stores some temporary files for its processing. Default: `scratch`" diff --git a/main b/main index 98499d9..0c5bece 100755 --- a/main +++ b/main @@ -10,10 +10,14 @@ rm -Rf "$(read_action_input scratch-dir)" && mkdir -p "$(read_action_input scrat : "Prepare Timestamp for Layer Cache Busting" date --iso=ns | tee "$(read_action_input cache-source)"/buildstamp : "Prepare Dancefile to Access Caches" + +cache_mount_id="$(read_action_input cache-id)" +cache_mount_id_string=$(test -n "$cache_mount_id" && echo "id=${cache_mount_id}," || echo '') + cat >"$(read_action_input scratch-dir)"/Dancefile.inject <