From 5f8bb5c1e70018919979ae79e41269627cad9bfb Mon Sep 17 00:00:00 2001 From: Mogeko Date: Wed, 17 Nov 2021 20:16:53 +0000 Subject: [PATCH 1/2] build(ci): always check metadata --- .github/workflows/build.yml | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0dd2a05..0289988 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,33 +8,23 @@ on: branches: - master -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository_owner }}/qbittorrent - jobs: check: runs-on: ubuntu-latest outputs: - old_ver: ${{ steps.check_ver.outputs.old_ver }} new_ver: ${{ steps.check_ver.outputs.new_ver }} steps: - name: Check version id: check_ver run: | - get_ver() (curl -s "$@" | grep -Po "(\d+\.)+\d+\-r\d+" | head -1) - OLD_VER=$(get_ver ${GHCO_URL}) - NEW_VER=$(get_ver ${ALPINE_PKG_URL}) - echo "::set-output name=old_ver::${OLD_VER}" + NEW_VER=$(curl -s "${ALPINE_PKG_URL}" | grep -Po "(\d+\.)+\d+\-r\d+" | head -1) echo "::set-output name=new_ver::${NEW_VER}" env: ALPINE_PKG_URL: https://pkgs.alpinelinux.org/package/edge/testing/x86_64/qbittorrent-nox - GHCO_URL: https://github.com/mogeko/docker-qbittorrent/pkgs/container/qbittorrent - build: + meta: runs-on: ubuntu-latest needs: check - if: ${{ needs.check.outputs.old_ver != needs.check.outputs.new_ver }} permissions: packages: write contents: read @@ -48,7 +38,9 @@ jobs: id: meta uses: docker/metadata-action@548e2346a9987b56d8a4104fe776321ff8e23440 with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + images: | + {{ github.repository_owner }}/qbittorrent + ghcr.io/{{ github.repository_owner }}/qbittorrent tags: | type=edge type=schedule,pattern={{date 'YYYYMMDD'}} From 032219bee271ef4ee697c5c9d1bc46f7fa9b7a99 Mon Sep 17 00:00:00 2001 From: Mogeko Date: Wed, 17 Nov 2021 20:23:06 +0000 Subject: [PATCH 2/2] build(ci): publish to dockerhub --- .github/workflows/auto-update.yml | 16 ++++++++++------ .github/workflows/build.yml | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/auto-update.yml b/.github/workflows/auto-update.yml index 4a18d1d..a679e14 100644 --- a/.github/workflows/auto-update.yml +++ b/.github/workflows/auto-update.yml @@ -4,10 +4,6 @@ on: schedule: - cron: '30 23 * * *' -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository_owner }}/qbittorrent - jobs: check: runs-on: ubuntu-latest @@ -40,10 +36,16 @@ jobs: with: fetch-depth: 0 + - name: Log in to Docker Hub + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Log in to the Container registry uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 with: - registry: ${{ env.REGISTRY }} + registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} @@ -51,7 +53,9 @@ jobs: id: meta uses: docker/metadata-action@548e2346a9987b56d8a4104fe776321ff8e23440 with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + images: | + ${{ github.repository_owner }}/qbittorrent + ghcr.io/${{ github.repository_owner }}/qbittorrent tags: | type=edge type=schedule,pattern={{date 'YYYYMMDD'}} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0289988..a9761bb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,8 +39,8 @@ jobs: uses: docker/metadata-action@548e2346a9987b56d8a4104fe776321ff8e23440 with: images: | - {{ github.repository_owner }}/qbittorrent - ghcr.io/{{ github.repository_owner }}/qbittorrent + ${{ github.repository_owner }}/qbittorrent + ghcr.io/${{ github.repository_owner }}/qbittorrent tags: | type=edge type=schedule,pattern={{date 'YYYYMMDD'}}