From ce94895710236cbc9cac2fa6ed65b31a45e3ff3b Mon Sep 17 00:00:00 2001 From: Antoine Lavenant Date: Tue, 9 Jul 2024 17:14:08 +0200 Subject: [PATCH] update docker action --- .github/workflows/cicd_docker.yml | 32 ++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cicd_docker.yml b/.github/workflows/cicd_docker.yml index 1adcbff..30bbcea 100644 --- a/.github/workflows/cicd_docker.yml +++ b/.github/workflows/cicd_docker.yml @@ -8,6 +8,8 @@ on: env: DOCKER_IMAGE_NAME: pdal_ign_plugin + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io jobs: build_docker_image_and_run_tests: @@ -24,4 +26,32 @@ jobs: - name: Run tests in docker image run: docker run ${{ env.DOCKER_IMAGE_NAME }}:test python -m pytest - + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + registry: ${{ env.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@v3 + with: + images: ${{ env.REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }} + + # 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 + id: build-and-push + uses: docker/build-push-action@v3 + with: + context: . + #push: ${{ github.event_name != 'pull_request' }} + push: True + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}