From c4d6f7f001a0863cd16ee7d5de8e45fd4ad10590 Mon Sep 17 00:00:00 2001 From: Linh Pham Date: Wed, 13 Aug 2025 15:07:00 +0700 Subject: [PATCH 1/5] feat: add GitHub workflow --- .github/workflows/build.yaml | 34 ++++++++++++++++++++++++++++++++++ Makefile | 2 ++ 2 files changed, 36 insertions(+) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..05decb4 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,34 @@ +name: Build and push Docker image + +on: + push: + branches: [main] + tags: ["*"] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + if: (github.ref == 'refs/heads/main' && (github.event_name == 'push')) || contains(github.ref, 'refs/tags/') + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + + - name: Push image + run: |- + make release-all diff --git a/Makefile b/Makefile index 53bea7e..32581f4 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,7 @@ release: ### Build and push image to DockerHub release-all: ### Build all PHP version and push image to DockerHub echo "Releasing all PHP version" VERSION=8.3 make release + VERSION=8.4 make release VERSION=8.2 make release VERSION=8.1 make release VERSION=8.0 make release @@ -29,6 +30,7 @@ test: ### Test image $(DOCKER_RUN) sh -c "nginx -t" test-all: ### Test all image + VERSION=8.4 make build test VERSION=8.3 make build test VERSION=8.2 make build test VERSION=8.1 make build test From 5bd224682e80b146302c0703773282a5c0f57128 Mon Sep 17 00:00:00 2001 From: Linh Pham Date: Wed, 13 Aug 2025 15:08:52 +0700 Subject: [PATCH 2/5] chore: remove redundant condition in Docker Hub login step --- .github/workflows/build.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 05decb4..09c423d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -23,7 +23,6 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Login to Docker Hub - if: (github.ref == 'refs/heads/main' && (github.event_name == 'push')) || contains(github.ref, 'refs/tags/') uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} From fc9dbe275e659bdd8d9fae2a4cb844ecffb7db70 Mon Sep 17 00:00:00 2001 From: Linh Pham Date: Wed, 13 Aug 2025 15:39:15 +0700 Subject: [PATCH 3/5] chore: update the GitHub workflow to test the image instead of pushing it --- .github/workflows/build.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 09c423d..8ab1d92 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -28,6 +28,10 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - - name: Push image + - name: Test image run: |- - make release-all + make test-all + +# - name: Push image +# run: |- +# make release-all From a927df421daba76af5e6f545322d25d96a0fb465 Mon Sep 17 00:00:00 2001 From: Linh Pham Date: Wed, 13 Aug 2025 15:50:45 +0700 Subject: [PATCH 4/5] chore: re-enable image pushing in GitHub workflow --- .github/workflows/build.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8ab1d92..4156418 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -32,6 +32,6 @@ jobs: run: |- make test-all -# - name: Push image -# run: |- -# make release-all + - name: Push image + run: |- + make release-all From 16d9916f32253f6c60d6abd05031bb2efc7f1adb Mon Sep 17 00:00:00 2001 From: Linh Pham Date: Wed, 13 Aug 2025 16:00:07 +0700 Subject: [PATCH 5/5] chore: remove pull_request trigger from GitHub workflow --- .github/workflows/build.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4156418..dd2421a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,8 +4,6 @@ on: push: branches: [main] tags: ["*"] - pull_request: - branches: [main] jobs: build: