From d08a88aed67329f4388309a5c88ab55433fd5fb4 Mon Sep 17 00:00:00 2001 From: Devin Buhl Date: Mon, 8 Apr 2024 04:12:33 -0400 Subject: [PATCH] feat: Push container image to GHCR (#95) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Push container image to GHCR Hi 👋🏼 Awesome project here... Dockerhub has aggressive pull rate limits, it would be awesome if you could push the image to Github Container Registry (GHCR) too. Dockerhub was one of the best years ago... GHCR is completely free for open source projects. It's also nice in that it integrates into your repo under the packages section. Take a look at my project [here](https://github.com/onedr0p/exportarr) and look at the packages on the right side. Thanks! This also bumps deps in the workflow * Update .github/workflows/dockerhub_build_push.yml * add perms --- .github/workflows/dockerhub_build_push.yml | 27 +++++++++++++++------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/dockerhub_build_push.yml b/.github/workflows/dockerhub_build_push.yml index e0fbf6b..a0e822e 100644 --- a/.github/workflows/dockerhub_build_push.yml +++ b/.github/workflows/dockerhub_build_push.yml @@ -9,29 +9,40 @@ on: jobs: docker: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest + permissions: + contents: read + packages: write steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@v3 + uses: docker/metadata-action@v5 with: - images: remirigal/plex-auto-languages + images: | + docker.io/remirigal/plex-auto-languages + ghcr.io/remirigal/plex-auto-languages tags: | type=ref,event=branch type=ref,event=tag - name: Build and push - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 with: context: . push: true