From 5b98c4d20ce938b35740fb7a80c5d33e74adb20b Mon Sep 17 00:00:00 2001 From: innovaker <66737976+innovaker@users.noreply.github.com> Date: Fri, 14 May 2021 19:12:34 +0100 Subject: [PATCH] refactor: move `repository-name` into a dedicated step Completes laying the groundwork for splitting the `docker` job into `candidates` and `releases`. PR: #41 --- .github/workflows/containers.yml | 34 +++++++++++++++----------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/.github/workflows/containers.yml b/.github/workflows/containers.yml index 499a1ef..c5fc7e1 100644 --- a/.github/workflows/containers.yml +++ b/.github/workflows/containers.yml @@ -108,11 +108,9 @@ jobs: registry: ghcr.io username: ${{ secrets.GHCR_USERNAME }} password: ${{ secrets.GHCR_TOKEN }} - - name: Prepare variables - id: vars - run: | - REPOSITORY_NAME=zmk-${{ matrix.target }}-${{ matrix.architecture }} - echo ::set-output name=repository-name::${REPOSITORY_NAME} + - name: Define repository + id: repository + run: echo ::set-output name=name::zmk-${{ matrix.target }}-${{ matrix.architecture }} - name: Set up QEMU if: ${{ !startsWith(github.ref, 'refs/tags') }} uses: docker/setup-qemu-action@v1 @@ -133,7 +131,7 @@ jobs: org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }} org.opencontainers.image.revision=${{ github.sha }} tags: | - docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ steps.vars.outputs.repository-name }}:${{ needs.tags.outputs.candidate }} + docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.candidate }} cache-from: type=registry,ref=docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ env.cache-repository-name }}:dev cache-to: ${{ (steps.docker-hub-login.outcome == 'success') && (matrix.target == 'dev') && format('type=registry,ref=docker.io/{0}/{1}:{2},mode=max', needs.namespaces.outputs.docker-hub, env.cache-repository-name, 'dev') || null }} push: ${{ steps.docker-hub-login.outcome == 'success' }} @@ -148,18 +146,18 @@ jobs: echo "GitHub Container Registry must be authenticated to perform a release!" exit 1 fi - docker pull docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ steps.vars.outputs.repository-name }}:${{ needs.tags.outputs.candidate }} - docker tag docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ steps.vars.outputs.repository-name }}:${{ needs.tags.outputs.candidate }} docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ steps.vars.outputs.repository-name }}:${{ needs.tags.outputs.versions }} - docker tag docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ steps.vars.outputs.repository-name }}:${{ needs.tags.outputs.candidate }} docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ steps.vars.outputs.repository-name }}:${{ needs.tags.outputs.latest }} - docker tag docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ steps.vars.outputs.repository-name }}:${{ needs.tags.outputs.candidate }} ghcr.io/${{ needs.namespaces.outputs.ghcr }}/${{ steps.vars.outputs.repository-name }}:${{ needs.tags.outputs.candidate }} - docker tag docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ steps.vars.outputs.repository-name }}:${{ needs.tags.outputs.candidate }} ghcr.io/${{ needs.namespaces.outputs.ghcr }}/${{ steps.vars.outputs.repository-name }}:${{ needs.tags.outputs.versions }} - docker tag docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ steps.vars.outputs.repository-name }}:${{ needs.tags.outputs.candidate }} ghcr.io/${{ needs.namespaces.outputs.ghcr }}/${{ steps.vars.outputs.repository-name }}:${{ needs.tags.outputs.latest }} - docker push docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ steps.vars.outputs.repository-name }}:${{ needs.tags.outputs.candidate }} - docker push docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ steps.vars.outputs.repository-name }}:${{ needs.tags.outputs.versions }} - docker push docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ steps.vars.outputs.repository-name }}:${{ needs.tags.outputs.latest }} - docker push ghcr.io/${{ needs.namespaces.outputs.ghcr }}/${{ steps.vars.outputs.repository-name }}:${{ needs.tags.outputs.candidate }} - docker push ghcr.io/${{ needs.namespaces.outputs.ghcr }}/${{ steps.vars.outputs.repository-name }}:${{ needs.tags.outputs.versions }} - docker push ghcr.io/${{ needs.namespaces.outputs.ghcr }}/${{ steps.vars.outputs.repository-name }}:${{ needs.tags.outputs.latest }} + docker pull docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.candidate }} + docker tag docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.candidate }} docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.versions }} + docker tag docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.candidate }} docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.latest }} + docker tag docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.candidate }} ghcr.io/${{ needs.namespaces.outputs.ghcr }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.candidate }} + docker tag docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.candidate }} ghcr.io/${{ needs.namespaces.outputs.ghcr }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.versions }} + docker tag docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.candidate }} ghcr.io/${{ needs.namespaces.outputs.ghcr }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.latest }} + docker push docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.candidate }} + docker push docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.versions }} + docker push docker.io/${{ needs.namespaces.outputs.docker-hub }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.latest }} + docker push ghcr.io/${{ needs.namespaces.outputs.ghcr }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.candidate }} + docker push ghcr.io/${{ needs.namespaces.outputs.ghcr }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.versions }} + docker push ghcr.io/${{ needs.namespaces.outputs.ghcr }}/${{ steps.repository.outputs.name }}:${{ needs.tags.outputs.latest }} git-tag: needs: - tags