Skip to content

Add cache-id option #52

Add cache-id option

Add cache-id option #52

Workflow file for this run

---
name: Test
on:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/metadata-action@v5
id: meta
with:
images: test
- name: Cache var-cache-apt
id: cache-var-cache-apt
uses: actions/cache@v3
with:
path: var-cache-apt
key: var-cache-apt-${{ hashFiles('.github/workflows/test/Dockerfile') }}
- name: Cache var-lib-apt
id: cache-var-lib-apt
uses: actions/cache@v3
with:
path: var-lib-apt
key: var-lib-apt-${{ hashFiles('.github/workflows/test/Dockerfile') }}
- name: inject var-cache-apt into docker
uses: ./
with:
cache-source: var-cache-apt
cache-target: /var/cache/apt
- name: inject var-lib-apt into docker
uses: ./
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
with:
context: .github/workflows/test
cache-from: type=gha
cache-to: type=gha,mode=max
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}