From 159b7f893b25c4c19aca9f64493ace0506a8b75a Mon Sep 17 00:00:00 2001 From: Volodymyr Kolesnykov Date: Mon, 30 Oct 2023 09:14:17 +0200 Subject: [PATCH] ci: refactor wordpress.yml --- .github/workflows/wordpress.yml | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/.github/workflows/wordpress.yml b/.github/workflows/wordpress.yml index c329ba61..78621f9a 100644 --- a/.github/workflows/wordpress.yml +++ b/.github/workflows/wordpress.yml @@ -7,10 +7,12 @@ on: paths: - "wordpress/**" - ".github/workflows/wordpress.yml" + - ".github/actions/build-docker-image/**" pull_request: paths: - "wordpress/**" - ".github/workflows/wordpress.yml" + - ".github/actions/build-docker-image/**" workflow_dispatch: permissions: @@ -44,6 +46,7 @@ jobs: permissions: contents: read packages: write + pull-requests: write strategy: fail-fast: false matrix: @@ -61,30 +64,17 @@ jobs: echo "tags=" >> $GITHUB_OUTPUT fi - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to GitHub Docker Registry - uses: docker/login-action@v3 - if: ${{ github.base_ref == null }} - with: - registry: https://ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build WordPress image - uses: docker/build-push-action@v5 + - name: Build and push image + uses: ./.github/actions/build-docker-image with: - platforms: linux/amd64,linux/arm64 context: wordpress push: ${{ github.base_ref == null }} - build-args: WP_GIT_REF=${{ matrix.wp.ref }} + args: WP_GIT_REF=${{ matrix.wp.ref }} cache-from: type=gha,scope=wordpress-${{ matrix.wp.ref }} cache-to: type=gha,mode=max,scope=wordpress-${{ matrix.wp.ref }} no-cache: ${{ matrix.wp.cacheable == false }} - tags: | - ghcr.io/automattic/vip-container-images/wordpress:${{ matrix.wp.tag }} - ${{ steps.extra-tags.outputs.tags }} + primaryTag: ghcr.io/automattic/vip-container-images/wordpress:${{ matrix.wp.tag }} + tags: ${{ steps.extra-tags.outputs.tags }} + registry: https://ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }}