From 8f735097e90b8e5e13265a79d5faad14e5b449d4 Mon Sep 17 00:00:00 2001 From: Thibault Jamet Date: Fri, 22 Sep 2023 23:03:57 +0200 Subject: [PATCH] Update push script to use ghcr.io --- .github/workflows/push.yml | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 8a065b4..f512855 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -13,7 +13,24 @@ jobs: runs-on: ubuntu-latest steps: - run: echo success + + login: + runs-on: ubuntu-latest + steps: + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: whalebrewci + password: ${{ secrets.DOCKER_HUB_PASSWORD }} + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} docker-build: + needs: + - login runs-on: ubuntu-latest strategy: fail-fast: false @@ -120,16 +137,14 @@ jobs: fi if: steps.is-modified.outputs.modified == 'true' || (github.event_name == 'push' && github.event.ref == 'refs/heads/re-builld-all') - run: | - echo ${{ secrets.DOCKER_HUB_PASSWORD }} | base64 -d | docker login --password-stdin -u whalebrewci - echo ${{ github.token }} | docker login --password-stdin -u ${{ github.actor }} docker.pkg.github.com docker tag ${{ matrix.image }} ${{ github.event.repository.owner.name}}/${{ matrix.image }} - docker tag ${{ matrix.image }} docker.pkg.github.com/${{ github.event.repository.owner.name }}/${{ github.event.repository.name }}/${{ matrix.image }} + docker tag ${{ matrix.image }} ghcr.io/${{ github.event.repository.owner.name }}/${{ github.event.repository.name }}/${{ matrix.image }} if [ -e "${{ matrix.image }}/tags.yaml" ]; then for tag in $(cat "${{ matrix.image }}/tags.yaml" | docker run --rm -i whalebrew/yq -r '.versions[]'); do docker tag ${{ matrix.image }}:${tag} ${{ github.event.repository.owner.name}}/${{ matrix.image }}:${tag} - docker tag ${{ matrix.image }}:${tag} docker.pkg.github.com/${{ github.event.repository.owner.name }}/${{ github.event.repository.name }}/${{ matrix.image }}:${tag} + docker tag ${{ matrix.image }}:${tag} ghcr.io/${{ github.event.repository.owner.name }}/${{ github.event.repository.name }}/${{ matrix.image }}:${tag} docker push ${{ github.event.repository.owner.name}}/${{ matrix.image }}:${tag} - docker push docker.pkg.github.com/${{ github.event.repository.owner.name}}/${{ github.event.repository.name }}/${{ matrix.image }}:${tag} + docker push ghcr.io/${{ github.event.repository.owner.name}}/${{ github.event.repository.name }}/${{ matrix.image }}:${tag} done fi