diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index a3c9f34..157d764 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -12,21 +12,48 @@ jobs: steps: + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + # list of Docker images to use as base name for tags + images: | + diaznet/arlo-downloader + # generate Docker tags based on the following events/attributes + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + # Log in to Docker Hub - name: Log in to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} + # Checkout - uses: actions/checkout@v4 + # Build and push Docker image - name: Build and push Docker image - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v6 with: - context: . # Set the context to the current directory - tags: ${{ github.actor }}/${{ github.event.repository.name }}:${{ github.ref_name }} - push: true # Push the image to Docker Hub + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + # Log-out of Docker Hub - name: Log out of Docker Hub run: docker logout \ No newline at end of file