-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[From review] Utilise composite action
- Loading branch information
Showing
2 changed files
with
48 additions
and
72 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
.github/actions/cache-cloud-provider-kind-image/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Cache cloud-provider-kind image | ||
description: Checks out, builds, and caches the cloud-provider-kind image | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Checkout cloud-provider-kind repo | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: kubernetes-sigs/cloud-provider-kind | ||
path: cloud-provider-kind | ||
|
||
- name: Generate cloud-provider-kind image cache key | ||
id: cloud-provider-kind-cache-key | ||
shell: bash | ||
run: echo "hash=$(cd cloud-provider-kind && git rev-parse HEAD)" >> $GITHUB_OUTPUT | ||
|
||
- name: Cache cloud-provider-kind image | ||
id: cloud-provider-kind-cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/cloud-provider-kind-image | ||
key: cloud-provider-kind-${{ steps.cloud-provider-kind-cache-key.outputs.hash }} | ||
|
||
- name: Load cached image | ||
if: steps.cloud-provider-kind-cache.outputs.cache-hit == 'true' | ||
shell: bash | ||
run: docker load < /tmp/cloud-provider-kind-image | ||
|
||
- name: Set up Docker Buildx | ||
if: steps.cloud-provider-kind-cache.outputs.cache-hit != 'true' | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build cloud-provider-kind image | ||
if: steps.cloud-provider-kind-cache.outputs.cache-hit != 'true' | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: ./cloud-provider-kind | ||
push: false | ||
tags: cloud-provider-kind-cloud-provider:latest | ||
load: true | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
outputs: type=docker,dest=/tmp/cloud-provider-kind-image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters