diff --git a/.github/workflows/containers.yml b/.github/workflows/containers.yml index b8b0e12..0800218 100644 --- a/.github/workflows/containers.yml +++ b/.github/workflows/containers.yml @@ -7,6 +7,7 @@ env: docker-hub-credentials: ${{ secrets.DOCKER_HUB_USERNAME != null && secrets.DOCKER_HUB_TOKEN != null }} ghcr-credentials: ${{ secrets.GHCR_USERNAME != null && secrets.GHCR_TOKEN != null }} docker-hub-namespace: ${{ secrets.DOCKER_HUB_NAMESPACE || github.repository_owner }} + docker-hub-namespace-upstream: ${{ secrets.DOCKER_HUB_NAMESPACE_UPSTREAM || 'zmkfirmware' }} ghcr-namespace: ${{ github.repository_owner }} zmk-repository: ${{ secrets.ZMK_REPOSITORY || 'zmkfirmware/zmk' }} zmk-ref: ${{ secrets.ZMK_REF || 'main' }} @@ -95,6 +96,7 @@ jobs: id: paths env: NS: ${{ env.docker-hub-namespace }} + NSU: ${{ env.docker-hub-namespace-upstream }} REPOSITORY: zmk-dev-generic-cache BRANCH: ${{ needs.tags.outputs.branch }} BASE: ${{ needs.tags.outputs.base }} @@ -105,6 +107,7 @@ jobs: if [ ! -z "$BASE" ]; then echo ::set-output name=base::docker.io/${NS}/${REPOSITORY}:${BASE} fi + echo ::set-output name=branch-upstream::docker.io/${NSU}/${REPOSITORY}:${BRANCH} - name: Set up cache id: cache uses: actions/cache@v2 @@ -132,6 +135,7 @@ jobs: cache-from: | type=registry,ref=${{ steps.paths.outputs.branch }} ${{ (steps.paths.outputs.base != '') && format('type=registry,ref={0}', steps.paths.outputs.base) || '' }} + type=registry,ref=${{ steps.paths.outputs.branch-upstream }} cache-to: type=local,dest=${{ steps.paths.outputs.local-new }},mode=max - name: Push to registry cache if: ${{ (steps.should-rebuild.outputs.value == 'true') && (env.docker-hub-credentials == 'true') }} @@ -197,6 +201,7 @@ jobs: shell: bash env: NS: ${{ env.docker-hub-namespace }} + NSU: ${{ env.docker-hub-namespace-upstream }} BUILD: ${{ steps.repositories.outputs.build }} DEV: ${{ steps.repositories.outputs.dev }} CANDIDATE: ${{ needs.tags.outputs.candidate }} @@ -209,11 +214,13 @@ jobs: if [ ! -z "$BASE" ]; then echo ::set-output name=build-base::docker.io/${NS}/${BUILD}:${BASE} fi + echo ::set-output name=build-branch-upstream::docker.io/${NSU}/${BUILD}:${BRANCH} echo ::set-output name=dev-candidate::docker.io/${NS}/${DEV}:${CANDIDATE} echo ::set-output name=dev-branch::docker.io/${NS}/${DEV}:${BRANCH} if [ ! -z "$BASE" ]; then echo ::set-output name=dev-base::docker.io/${NS}/${DEV}:${BASE} fi + echo ::set-output name=dev-branch-upstream::docker.io/${NSU}/${DEV}:${BRANCH} - name: Define build-args id: build-args shell: bash @@ -271,6 +278,7 @@ jobs: type=registry,ref=${{ steps.paths.outputs.build-candidate }} type=registry,ref=${{ steps.paths.outputs.build-branch }} ${{ (steps.paths.outputs.build-base != '') && format('type=registry,ref={0}', steps.paths.outputs.build-base) || '' }} + type=registry,ref=${{ steps.paths.outputs.build-branch-upstream }} cache-to: type=inline load: true - name: Build and load 'dev' candidate image @@ -290,6 +298,7 @@ jobs: type=registry,ref=${{ steps.paths.outputs.dev-candidate }} type=registry,ref=${{ steps.paths.outputs.dev-branch }} ${{ (steps.paths.outputs.dev-base != '') && format('type=registry,ref={0}', steps.paths.outputs.dev-base) || '' }} + type=registry,ref=${{ steps.paths.outputs.dev-branch-upstream }} cache-to: type=inline load: true - name: Checkout ZMK