Skip to content

Commit

Permalink
ci: enhance CI/CD pipeline with caching and normalization
Browse files Browse the repository at this point in the history
- Add a step to downcase the repository name and store it in the environment variable
- Add cache-from and cache-to options for the build and push step

Signed-off-by: appleboy <appleboy.tw@gmail.com>
  • Loading branch information
appleboy committed May 31, 2024
1 parent 24c1eda commit 976e75d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ jobs:
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: downcase REPO
run: |
echo "REPO=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV}
- name: Build and push
uses: docker/build-push-action@v5
with:
Expand All @@ -71,3 +75,5 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker-meta.outputs.tags }}
labels: ${{ steps.docker-meta.outputs.labels }}
cache-from: type=registry,ref=ghcr.io/${{ env.REPO }}:buildcache
cache-to: type=registry,ref=ghcr.io/${{ env.REPO }}:buildcache,mode=max

0 comments on commit 976e75d

Please sign in to comment.