Skip to content

Commit

Permalink
fix: cache 3
Browse files Browse the repository at this point in the history
  • Loading branch information
plexoos committed Apr 25, 2024
1 parent 6dce7a9 commit 8dd957a
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ jobs:
needs: test
steps:
- name: Define environment variables
run: echo IMAGE_SHA=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):${{ github.sha }} >> $GITHUB_ENV
run: |
echo IMAGE_SHA=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):${{ github.sha }} >> $GITHUB_ENV
echo IMAGE_REG=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
- name: Checkout Code
uses: actions/checkout@v4
Expand All @@ -125,31 +127,47 @@ jobs:
# ${{ steps.semantic.outputs.new_release_version }}
# docker push ghcr.io/${{ github.repository_owner }}/esi-opticks:${{ github.sha }}

- run: echo ${{ steps.semantic.outputs.new_release_git_tag }}
- run: echo ${{ steps.semantic.outputs.new_release_version }}

- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ steps.semantic.outputs.new_release_git_tag }}

- name: Download image
uses: actions/download-artifact@v4
#- name: Download image
# uses: actions/download-artifact@v4
# with:
# name: esi-opticks-${{ github.sha }}
# path: /tmp

- name: Cache Docker layers
uses: actions/cache@v3
with:
name: esi-opticks-${{ github.sha }}
path: /tmp
path: /tmp/buildx-cache
key: esi-opticks-${{ github.sha }}

- name: Load Image
run: docker load --input /tmp/esi-opticks-${{ github.sha }}.tar
run: docker load --input /tmp/buildx-cache/esi-opticks-${{ github.sha }}.tar

- name: Set up Docker buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build container
uses: docker/build-push-action@v5
with:
file: Dockerfile.test
tags: |
ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):${{ steps.semantic.outputs.new_release_version }}
ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):latest
tags: ${{ env.IMAGE_REG }}:latest
#${{ env.IMAGE_REG }}:${{ steps.semantic.outputs.new_release_version }}
push: true
cache-from: type=registry,ref=${{ env.IMAGE_SHA }}
cache-from: ${{ env.IMAGE_SHA }}
#cache-from: type=registry,ref=${{ env.IMAGE_SHA }}
#cache-to: type=inline
#outputs: type=docker,dest=/tmp/esi-opticks-${{ github.sha }}.tar

0 comments on commit 8dd957a

Please sign in to comment.