From 13e5d8c9361136a6da4361185ddb1fe7e4ab0003 Mon Sep 17 00:00:00 2001 From: Ramiro Date: Mon, 2 Mar 2026 21:08:12 +0200 Subject: [PATCH 1/3] ci: build on PR and push image on main --- .github/workflows/dockerfile-validation.yml | 31 ++++++++++++++------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/.github/workflows/dockerfile-validation.yml b/.github/workflows/dockerfile-validation.yml index 5f8d3ac..4150528 100644 --- a/.github/workflows/dockerfile-validation.yml +++ b/.github/workflows/dockerfile-validation.yml @@ -1,4 +1,4 @@ -name: Dockerfile Validation +name: Docker Build and Publish on: push: @@ -13,28 +13,39 @@ on: - '.github/workflows/dockerfile-validation.yml' jobs: - validate-dockerfile: + docker: runs-on: ubuntu-latest - + permissions: + contents: read + packages: write + steps: - name: Checkout code uses: actions/checkout@v4 - + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - + - name: Lint Dockerfile uses: hadolint/hadolint-action@v3.1.0 with: dockerfile: Dockerfile failure-threshold: warning - - - name: Build Docker image + + - name: Log in to GitHub Container Registry + if: github.event_name == 'push' + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build Docker image (PR) / Build and push image (main) uses: docker/build-push-action@v5 with: context: . file: ./Dockerfile - push: false - tags: test-build:latest + push: ${{ github.event_name == 'push' }} + tags: ghcr.io/okteto/deploy-preview:main cache-from: type=gha - cache-to: type=gha,mode=max \ No newline at end of file + cache-to: type=gha,mode=max From ad3739055c0b4a2e8b1a9fc9c2fdb5ad0c1f9e4a Mon Sep 17 00:00:00 2001 From: Ramiro Date: Mon, 2 Mar 2026 22:42:57 +0200 Subject: [PATCH 2/3] default to the image build in main --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 0e90164..517e515 100644 --- a/action.yml +++ b/action.yml @@ -31,7 +31,7 @@ inputs: required: false runs: using: "docker" - image: "Dockerfile" + image: "ghcr.io/okteto/deploy-preview:main" args: - ${{ inputs.name }} - ${{ inputs.timeout }} From 688c95e882973e8eab4c6f85b37d0745a39d598d Mon Sep 17 00:00:00 2001 From: Ramiro Date: Mon, 2 Mar 2026 22:54:55 +0200 Subject: [PATCH 3/3] fix syntax --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 517e515..6f62361 100644 --- a/action.yml +++ b/action.yml @@ -31,7 +31,7 @@ inputs: required: false runs: using: "docker" - image: "ghcr.io/okteto/deploy-preview:main" + image: "docker://ghcr.io/okteto/deploy-preview:main" args: - ${{ inputs.name }} - ${{ inputs.timeout }}