diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9973f0eec..fe52da55d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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