diff --git a/.github/actions/setup-docker-environment/action.yaml b/.github/actions/setup-docker-environment/action.yaml index c55a7955..94da7514 100644 --- a/.github/actions/setup-docker-environment/action.yaml +++ b/.github/actions/setup-docker-environment/action.yaml @@ -7,6 +7,12 @@ inputs: password: description: "Password" required: true + ghcr_username: + description: "GHCR username. Usually set from the github.actor variable" + required: true + ghcr_password: + description: "GHCR password. Usually set from the secrets.GITHUB_TOKEN variable" + required: true outputs: sha_short: @@ -36,3 +42,11 @@ runs: with: username: ${{ inputs.username }} password: ${{ inputs.password }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + if: ${{ github.ref == 'master' && github.event.pull_request.merged == true }} + with: + registry: ghcr.io + username: ${{ inputs.ghcr_username }} + password: ${{ inputs.ghcr_password }} diff --git a/.github/workflows/runners.yml b/.github/workflows/runners.yml index b039bc88..ae4c9ee9 100644 --- a/.github/workflows/runners.yml +++ b/.github/workflows/runners.yml @@ -46,6 +46,8 @@ jobs: with: username: ${{ secrets.DOCKER_USER }} password: ${{ secrets.DOCKER_ACCESS_TOKEN }} + ghcr_username: ${{ github.actor }} + ghcr_password: ${{ secrets.GITHUB_TOKEN }} - name: Build and Push Versioned Tags uses: docker/build-push-action@v2 @@ -61,5 +63,8 @@ jobs: ${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:v${{ env.RUNNER_VERSION }}-${{ matrix.os-name }}-${{ matrix.os-version }} ${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:v${{ env.RUNNER_VERSION }}-${{ matrix.os-name }}-${{ matrix.os-version }}-${{ steps.vars.outputs.sha_short }} ${{ env.DOCKERHUB_USERNAME }}/${{ matrix.name }}:latest + ghcr.io/${{ github.repository }}/${{ matrix.name }}:latest + ghcr.io/${{ github.repository }}/${{ matrix.name }}:v${{ env.RUNNER_VERSION }}-${{ matrix.os-name }}-${{ matrix.os-version }} + ghcr.io/${{ github.repository }}/${{ matrix.name }}:v${{ env.RUNNER_VERSION }}-${{ matrix.os-name }}-${{ matrix.os-version }}-${{ steps.vars.outputs.sha_short }} cache-from: type=gha cache-to: type=gha,mode=max