]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Updates the workflow to enable Docker Hub pushing 828/head
authorTrenton Holmes <trenton.holmes@psware.com>
Thu, 28 Apr 2022 18:37:52 +0000 (11:37 -0700)
committerTrenton Holmes <trenton.holmes@psware.com>
Thu, 28 Apr 2022 19:18:25 +0000 (12:18 -0700)
.github/workflows/ci.yml

index 9973f0eec56ac4a325c7e3b831c84d84662bfd6b..fe52da55daa51d9238c973119d3ace610566c7f1 100644 (file)
@@ -63,13 +63,6 @@ jobs:
       -
         name: Checkout
         uses: actions/checkout@v3
-      -
-        name: Login to Github Container Registry
-        uses: docker/login-action@v1
-        with:
-          registry: ghcr.io
-          username: ${{ github.actor }}
-          password: ${{ secrets.GITHUB_TOKEN }}
       -
         name: Set up Python
         uses: actions/setup-python@v3
@@ -247,12 +240,25 @@ jobs:
       - build-pikepdf-wheel
       - build-frontend
     steps:
+      -
+        name: Check pushing to Docker Hub
+        id: docker-hub
+        # Only push to Dockerhub from the main repo
+        # Otherwise forks would require a Docker Hub account and secrets setup
+        run: |
+          if [[ ${{ github.repository }} == "paperless-ngx/paperless-ngx" ]] ; then
+            echo ::set-output name=enable::"true"
+          else
+            echo ::set-output name=enable::"false"
+          fi
       -
         name: Gather Docker metadata
         id: docker-meta
         uses: docker/metadata-action@v3
         with:
-          images: ghcr.io/${{ github.repository }}
+          images: |
+            ghcr.io/${{ github.repository }}
+            name=paperlessngx/paperless-ngx,enable=${{ steps.docker-hub.outputs.enable }}
           tags: |
             type=ref,event=branch
             type=ref,event=tag
@@ -272,6 +278,14 @@ jobs:
           registry: ghcr.io
           username: ${{ github.actor }}
           password: ${{ secrets.GITHUB_TOKEN }}
+      -
+        name: Login to Docker Hub
+        uses: docker/login-action@v1
+        # Don't attempt to login is not pushing to Docker Hub
+        if: steps.docker-hub.outputs.enable == 'true'
+        with:
+          username: ${{ secrets.DOCKERHUB_USERNAME }}
+          password: ${{ secrets.DOCKERHUB_TOKEN }}
       -
         name: Build and push
         uses: docker/build-push-action@v2