feat: add cache-from major-minor-branch
Lets any branch utilize its corresponding major-minor-branch cache. See: #62 PR: #68
This commit is contained in:
parent
b551a568f5
commit
88620c678e
17
.github/workflows/containers.yml
vendored
17
.github/workflows/containers.yml
vendored
@ -43,6 +43,7 @@ jobs:
|
|||||||
candidate: ${{ steps.definitions.outputs.candidate }}
|
candidate: ${{ steps.definitions.outputs.candidate }}
|
||||||
versions: ${{ steps.definitions.outputs.versions }}
|
versions: ${{ steps.definitions.outputs.versions }}
|
||||||
major-minor: ${{ steps.definitions.outputs.major-minor }}
|
major-minor: ${{ steps.definitions.outputs.major-minor }}
|
||||||
|
major-minor-branch: ${{ steps.definitions.outputs.major-minor-branch }}
|
||||||
latest: ${{ steps.definitions.outputs.latest }}
|
latest: ${{ steps.definitions.outputs.latest }}
|
||||||
release-trigger: ${{ steps.definitions.outputs.release-trigger }}
|
release-trigger: ${{ steps.definitions.outputs.release-trigger }}
|
||||||
steps:
|
steps:
|
||||||
@ -61,6 +62,7 @@ jobs:
|
|||||||
MAJOR=$(echo ${ZEPHYR_VERSION} | cut -d'.' -f 1)
|
MAJOR=$(echo ${ZEPHYR_VERSION} | cut -d'.' -f 1)
|
||||||
MINOR=$(echo ${ZEPHYR_VERSION} | cut -d'.' -f 2)
|
MINOR=$(echo ${ZEPHYR_VERSION} | cut -d'.' -f 2)
|
||||||
MAJOR_MINOR=${MAJOR}.${MINOR}
|
MAJOR_MINOR=${MAJOR}.${MINOR}
|
||||||
|
MAJOR_MINOR_BRANCH=${MAJOR_MINOR}-branch
|
||||||
LATEST=${MAJOR_MINOR}
|
LATEST=${MAJOR_MINOR}
|
||||||
RELEASE_TRIGGER=${ZEPHYR_VERSION}-${ZEPHYR_SDK_VERSION}
|
RELEASE_TRIGGER=${ZEPHYR_VERSION}-${ZEPHYR_SDK_VERSION}
|
||||||
|
|
||||||
@ -69,6 +71,7 @@ jobs:
|
|||||||
echo ::set-output name=candidate::${CANDIDATE}
|
echo ::set-output name=candidate::${CANDIDATE}
|
||||||
echo ::set-output name=versions::${VERSIONS}
|
echo ::set-output name=versions::${VERSIONS}
|
||||||
echo ::set-output name=major-minor::${MAJOR_MINOR}
|
echo ::set-output name=major-minor::${MAJOR_MINOR}
|
||||||
|
echo ::set-output name=major-minor-branch::${MAJOR_MINOR_BRANCH}
|
||||||
echo ::set-output name=latest::${LATEST}
|
echo ::set-output name=latest::${LATEST}
|
||||||
echo ::set-output name=release-trigger::${RELEASE_TRIGGER}
|
echo ::set-output name=release-trigger::${RELEASE_TRIGGER}
|
||||||
dev-generic:
|
dev-generic:
|
||||||
@ -100,6 +103,7 @@ jobs:
|
|||||||
REPOSITORY: zmk-dev-generic-cache
|
REPOSITORY: zmk-dev-generic-cache
|
||||||
BRANCH: ${{ needs.tags.outputs.branch }}
|
BRANCH: ${{ needs.tags.outputs.branch }}
|
||||||
BASE: ${{ needs.tags.outputs.base }}
|
BASE: ${{ needs.tags.outputs.base }}
|
||||||
|
MAJOR_MINOR_BRANCH: ${{ needs.tags.outputs.major-minor-branch }}
|
||||||
run: |
|
run: |
|
||||||
echo ::set-output name=local::/tmp/.buildx/dev-generic
|
echo ::set-output name=local::/tmp/.buildx/dev-generic
|
||||||
echo ::set-output name=local-new::/tmp/.buildx/dev-generic-new
|
echo ::set-output name=local-new::/tmp/.buildx/dev-generic-new
|
||||||
@ -107,7 +111,9 @@ jobs:
|
|||||||
if [ ! -z "$BASE" ]; then
|
if [ ! -z "$BASE" ]; then
|
||||||
echo ::set-output name=base::docker.io/${NS}/${REPOSITORY}:${BASE}
|
echo ::set-output name=base::docker.io/${NS}/${REPOSITORY}:${BASE}
|
||||||
fi
|
fi
|
||||||
|
echo ::set-output name=major-minor-branch::docker.io/${NS}/${REPOSITORY}:${MAJOR_MINOR_BRANCH}
|
||||||
echo ::set-output name=branch-upstream::docker.io/${NSU}/${REPOSITORY}:${BRANCH}
|
echo ::set-output name=branch-upstream::docker.io/${NSU}/${REPOSITORY}:${BRANCH}
|
||||||
|
echo ::set-output name=major-minor-branch-upstream::docker.io/${NSU}/${REPOSITORY}:${MAJOR_MINOR_BRANCH}
|
||||||
- name: Set up cache
|
- name: Set up cache
|
||||||
id: cache
|
id: cache
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
@ -135,7 +141,9 @@ jobs:
|
|||||||
cache-from: |
|
cache-from: |
|
||||||
type=registry,ref=${{ steps.paths.outputs.branch }}
|
type=registry,ref=${{ steps.paths.outputs.branch }}
|
||||||
${{ (steps.paths.outputs.base != '') && format('type=registry,ref={0}', steps.paths.outputs.base) || '' }}
|
${{ (steps.paths.outputs.base != '') && format('type=registry,ref={0}', steps.paths.outputs.base) || '' }}
|
||||||
|
type=registry,ref=${{ steps.paths.outputs.major-minor-branch }}
|
||||||
type=registry,ref=${{ steps.paths.outputs.branch-upstream }}
|
type=registry,ref=${{ steps.paths.outputs.branch-upstream }}
|
||||||
|
type=registry,ref=${{ steps.paths.outputs.major-minor-branch-upstream }}
|
||||||
cache-to: type=local,dest=${{ steps.paths.outputs.local-new }},mode=max
|
cache-to: type=local,dest=${{ steps.paths.outputs.local-new }},mode=max
|
||||||
- name: Push to registry cache
|
- name: Push to registry cache
|
||||||
if: ${{ (steps.should-rebuild.outputs.value == 'true') && (env.docker-hub-credentials == 'true') }}
|
if: ${{ (steps.should-rebuild.outputs.value == 'true') && (env.docker-hub-credentials == 'true') }}
|
||||||
@ -207,6 +215,7 @@ jobs:
|
|||||||
CANDIDATE: ${{ needs.tags.outputs.candidate }}
|
CANDIDATE: ${{ needs.tags.outputs.candidate }}
|
||||||
BRANCH: ${{ needs.tags.outputs.branch }}
|
BRANCH: ${{ needs.tags.outputs.branch }}
|
||||||
BASE: ${{ needs.tags.outputs.base }}
|
BASE: ${{ needs.tags.outputs.base }}
|
||||||
|
MAJOR_MINOR_BRANCH: ${{ needs.tags.outputs.major-minor-branch }}
|
||||||
run: |
|
run: |
|
||||||
echo ::set-output name=dev-generic::/tmp/.buildx/dev-generic
|
echo ::set-output name=dev-generic::/tmp/.buildx/dev-generic
|
||||||
echo ::set-output name=build-candidate::docker.io/${NS}/${BUILD}:${CANDIDATE}
|
echo ::set-output name=build-candidate::docker.io/${NS}/${BUILD}:${CANDIDATE}
|
||||||
@ -214,13 +223,17 @@ jobs:
|
|||||||
if [ ! -z "$BASE" ]; then
|
if [ ! -z "$BASE" ]; then
|
||||||
echo ::set-output name=build-base::docker.io/${NS}/${BUILD}:${BASE}
|
echo ::set-output name=build-base::docker.io/${NS}/${BUILD}:${BASE}
|
||||||
fi
|
fi
|
||||||
|
echo ::set-output name=build-major-minor-branch::docker.io/${NS}/${BUILD}:${MAJOR_MINOR_BRANCH}
|
||||||
echo ::set-output name=build-branch-upstream::docker.io/${NSU}/${BUILD}:${BRANCH}
|
echo ::set-output name=build-branch-upstream::docker.io/${NSU}/${BUILD}:${BRANCH}
|
||||||
|
echo ::set-output name=build-major-minor-branch-upstream::docker.io/${NSU}/${BUILD}:${MAJOR_MINOR_BRANCH}
|
||||||
echo ::set-output name=dev-candidate::docker.io/${NS}/${DEV}:${CANDIDATE}
|
echo ::set-output name=dev-candidate::docker.io/${NS}/${DEV}:${CANDIDATE}
|
||||||
echo ::set-output name=dev-branch::docker.io/${NS}/${DEV}:${BRANCH}
|
echo ::set-output name=dev-branch::docker.io/${NS}/${DEV}:${BRANCH}
|
||||||
if [ ! -z "$BASE" ]; then
|
if [ ! -z "$BASE" ]; then
|
||||||
echo ::set-output name=dev-base::docker.io/${NS}/${DEV}:${BASE}
|
echo ::set-output name=dev-base::docker.io/${NS}/${DEV}:${BASE}
|
||||||
fi
|
fi
|
||||||
|
echo ::set-output name=dev-major-minor-branch::docker.io/${NS}/${DEV}:${MAJOR_MINOR_BRANCH}
|
||||||
echo ::set-output name=dev-branch-upstream::docker.io/${NSU}/${DEV}:${BRANCH}
|
echo ::set-output name=dev-branch-upstream::docker.io/${NSU}/${DEV}:${BRANCH}
|
||||||
|
echo ::set-output name=dev-major-minor-branch-upstream::docker.io/${NSU}/${DEV}:${MAJOR_MINOR_BRANCH}
|
||||||
- name: Define build-args
|
- name: Define build-args
|
||||||
id: build-args
|
id: build-args
|
||||||
shell: bash
|
shell: bash
|
||||||
@ -278,7 +291,9 @@ jobs:
|
|||||||
type=registry,ref=${{ steps.paths.outputs.build-candidate }}
|
type=registry,ref=${{ steps.paths.outputs.build-candidate }}
|
||||||
type=registry,ref=${{ steps.paths.outputs.build-branch }}
|
type=registry,ref=${{ steps.paths.outputs.build-branch }}
|
||||||
${{ (steps.paths.outputs.build-base != '') && format('type=registry,ref={0}', steps.paths.outputs.build-base) || '' }}
|
${{ (steps.paths.outputs.build-base != '') && format('type=registry,ref={0}', steps.paths.outputs.build-base) || '' }}
|
||||||
|
type=registry,ref=${{ steps.paths.outputs.build-major-minor-branch }}
|
||||||
type=registry,ref=${{ steps.paths.outputs.build-branch-upstream }}
|
type=registry,ref=${{ steps.paths.outputs.build-branch-upstream }}
|
||||||
|
type=registry,ref=${{ steps.paths.outputs.build-major-minor-branch-upstream }}
|
||||||
cache-to: type=inline
|
cache-to: type=inline
|
||||||
load: true
|
load: true
|
||||||
- name: Build and load 'dev' candidate image
|
- name: Build and load 'dev' candidate image
|
||||||
@ -298,7 +313,9 @@ jobs:
|
|||||||
type=registry,ref=${{ steps.paths.outputs.dev-candidate }}
|
type=registry,ref=${{ steps.paths.outputs.dev-candidate }}
|
||||||
type=registry,ref=${{ steps.paths.outputs.dev-branch }}
|
type=registry,ref=${{ steps.paths.outputs.dev-branch }}
|
||||||
${{ (steps.paths.outputs.dev-base != '') && format('type=registry,ref={0}', steps.paths.outputs.dev-base) || '' }}
|
${{ (steps.paths.outputs.dev-base != '') && format('type=registry,ref={0}', steps.paths.outputs.dev-base) || '' }}
|
||||||
|
type=registry,ref=${{ steps.paths.outputs.dev-major-minor-branch }}
|
||||||
type=registry,ref=${{ steps.paths.outputs.dev-branch-upstream }}
|
type=registry,ref=${{ steps.paths.outputs.dev-branch-upstream }}
|
||||||
|
type=registry,ref=${{ steps.paths.outputs.dev-major-minor-branch-upstream }}
|
||||||
cache-to: type=inline
|
cache-to: type=inline
|
||||||
load: true
|
load: true
|
||||||
- name: Checkout ZMK
|
- name: Checkout ZMK
|
||||||
|
Loading…
Reference in New Issue
Block a user