Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Fix cache key hashed file name #487

Fix cache key hashed file name

Fix cache key hashed file name #487

Workflow file for this run

name: Container
on:
push:
pull_request:
jobs:
build:
# Deduplicate jobs from pull requests and branch pushes within the same repo.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
matrix:
target:
- chimp_chomp
- soakdb_sync
- pin_packing
max-parallel: 1
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout with LFS
uses: actions/checkout@v3.5.3
- name: List LFS Files
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-file-ids
- name: Cache LFS Files
uses: actions/cache@v1.2.1
with:
path: ./git/lfs
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-file-ids') }}
- name: Pull LFS Files
run: git lfs pull
- name: Generate Image Name
run: echo IMAGE_REPOSITORY=ghcr.io/$(echo "${{ github.repository }}-${{ matrix.target }}" | tr '[:upper:]' '[:lower:]' | tr '[_]' '[\-]') >> $GITHUB_ENV
- name: Log in to GitHub Docker Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v2.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker Metadata
id: meta
uses: docker/metadata-action@v4.6.0
with:
images: ${{ env.IMAGE_REPOSITORY }}
tags: |
type=ref,event=tag
type=raw,value=latest
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.9.1
- name: Build Image
uses: docker/build-push-action@v4.1.1
with:
context: .
target: ${{ matrix.target }}
push: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
load: ${{ !(github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max