diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 69cb155..906345c 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -63,13 +63,13 @@ jobs: docker build . --file Dockerfile fi - # Push daemon image to GitHub Packages. - push-daemon-to-github-packages: + # Push daemon image to registry. + push-daemon: # Ensure test job passes before pushing image. needs: test-daemon - name: Build Daemon & Push to GitHub Registry + name: Build & Push Daemon runs-on: ubuntu-latest permissions: contents: read @@ -85,80 +85,32 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - # Login against a Docker registry except on PR - # https://github.com/docker/login-action - - name: Log into registry ${{ env.GITHUB_REGISTRY }} + # Login to Docker Hub except on PR + - name: Login to Docker Hub if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: - registry: ${{ env.GITHUB_REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - # Extract metadata (tags, labels) for Docker - # https://github.com/docker/metadata-action - - name: Extract Docker metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME_DAEMON }} - tags: | - type=ref,event=branch - type=semver,pattern={{version}} - type=semver,pattern={{major}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}}.{{minor}}.{{patch}} - - # Build and push Docker image with Buildx (don't push on PR) - # https://github.com/docker/build-push-action - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: ./daemon/ - platforms: linux/amd64,linux/arm64,linux/arm/v7 - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - # Push client image to GitHub Packages. - push-client-to-github-packages: - - # Ensure test job passes before pushing image. - needs: test-client - - name: Build Client & Push to GitHub Registry - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + registry: ${{ env.DOCKER_REGISTRY }} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - # Login against a Docker registry except on PR - # https://github.com/docker/login-action - - name: Log into registry ${{ env.GITHUB_REGISTRY }} + # Login to GitHub Container Registry except on PR + - name: Login to GitHub Container Registry if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: registry: ${{ env.GITHUB_REGISTRY }} - username: ${{ github.actor }} + username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} # Extract metadata (tags, labels) for Docker - # https://github.com/docker/metadata-action - name: Extract Docker metadata id: meta uses: docker/metadata-action@v5 with: - images: ${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME_CLIENT }} + images: | + ${{ env.IMAGE_NAME_DAEMON }} + ${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME_DAEMON }} tags: | type=ref,event=branch type=semver,pattern={{version}} @@ -167,25 +119,23 @@ jobs: type=semver,pattern={{major}}.{{minor}}.{{patch}} # Build and push Docker image with Buildx (don't push on PR) - # https://github.com/docker/build-push-action - name: Build and push Docker image uses: docker/build-push-action@v5 with: - context: . + context: ./daemon/ platforms: linux/amd64,linux/arm64,linux/arm/v7 push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - # Push daemon image to Docker Hub. - push-daemon-to-docker-hub: + # Push client image to registry. + push-client: # Ensure test job passes before pushing image. - needs: test-daemon + needs: test-client - name: Build Daemon & Push to Docker Hub + name: Build & Push Client runs-on: ubuntu-latest - if: github.event_name != 'pull_request' # no need to exec same build two times during PR (no final push) permissions: contents: read packages: write @@ -200,9 +150,8 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - # Login against a Docker registry except on PR - # https://github.com/docker/login-action - - name: Log into registry ${{ env.DOCKER_REGISTRY }} + # Login to Docker Hub except on PR + - name: Login to Docker Hub if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: @@ -210,71 +159,23 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - # Extract metadata (tags, labels) for Docker - # https://github.com/docker/metadata-action - - name: Extract Docker metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.IMAGE_NAME_DAEMON }} - tags: | - type=ref,event=branch - type=semver,pattern={{version}} - type=semver,pattern={{major}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}}.{{minor}}.{{patch}} - - # Build and push Docker image with Buildx (don't push on PR) - # https://github.com/docker/build-push-action - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - context: ./daemon/ - platforms: linux/amd64,linux/arm64,linux/arm/v7 - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - - # Push client image to Docker Hub. - push-client-to-docker-hub: - - # Ensure test job passes before pushing image. - needs: test-client - - name: Build Client & Push to Docker Hub - runs-on: ubuntu-latest - if: github.event_name != 'pull_request' # no need to exec same build two times during PR (no final push) - permissions: - contents: read - packages: write - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - # Login against a Docker registry except on PR - # https://github.com/docker/login-action - - name: Log into registry ${{ env.DOCKER_REGISTRY }} + # Login to GitHub Container Registry except on PR + - name: Login to GitHub Container Registry if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: - registry: ${{ env.DOCKER_REGISTRY }} - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} + registry: ${{ env.GITHUB_REGISTRY }} + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} # Extract metadata (tags, labels) for Docker - # https://github.com/docker/metadata-action - name: Extract Docker metadata id: meta uses: docker/metadata-action@v5 with: - images: ${{ env.IMAGE_NAME_CLIENT }} + images: | + ${{ env.IMAGE_NAME_CLIENT }} + ${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME_CLIENT }} tags: | type=ref,event=branch type=semver,pattern={{version}} @@ -283,7 +184,6 @@ jobs: type=semver,pattern={{major}}.{{minor}}.{{patch}} # Build and push Docker image with Buildx (don't push on PR) - # https://github.com/docker/build-push-action - name: Build and push Docker image uses: docker/build-push-action@v5 with: