From 71f5b74370924225e070995198d136b9d20bd2c4 Mon Sep 17 00:00:00 2001 From: andrew Date: Sat, 20 Jul 2024 22:03:13 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20change:=20improve=20CI=20flow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci-dev.yml | 69 ++++++++++++++++++++++++++++------ .github/workflows/publish.yaml | 66 +++++++++++++++++++++++++------- 2 files changed, 110 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci-dev.yml b/.github/workflows/ci-dev.yml index 881e6d1..dcdad9b 100644 --- a/.github/workflows/ci-dev.yml +++ b/.github/workflows/ci-dev.yml @@ -10,14 +10,6 @@ env: jobs: build-and-push-image: runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - - image: vngcloud-ingress-controller - - image: vngcloud-controller-manager - - image: vngcloud-cm-webhook - - image: vngcloud-ic-webhook permissions: contents: read packages: write @@ -41,6 +33,8 @@ jobs: password: ${{ secrets.VCR_PASSWORD }} - name: Build and push Docker image + env: + TARGET: vngcloud-ingress-controller uses: docker/build-push-action@v5 with: context: . @@ -50,7 +44,58 @@ jobs: platforms: linux/amd64 outputs: type=registry tags: | - ghcr.io/vngcloud/${{ matrix.image }}:${{ github.sha }} - ${{ env.REPO }}/${{ matrix.image }}:${{ github.sha }} - ${{ env.REPO }}/${{ matrix.image }}:${{ env.VERSION }} - target: ${{ matrix.image }} + ghcr.io/vngcloud/vngcloud-ingress-controller:${{ github.sha }} + ${{ env.REPO }}/vngcloud-ingress-controller:${{ github.sha }} + ${{ env.REPO }}/vngcloud-ingress-controller:${{ env.VERSION }} + target: vngcloud-ingress-controller + + - name: Build and push Docker image + env: + TARGET: vngcloud-controller-manager + uses: docker/build-push-action@v5 + with: + context: . + push: true + build-args: | + VERSION=${{ env.VERSION }} + platforms: linux/amd64 + outputs: type=registry + tags: | + ghcr.io/vngcloud/vngcloud-controller-manager:${{ github.sha }} + ${{ env.REPO }}/vngcloud-controller-manager:${{ github.sha }} + ${{ env.REPO }}/vngcloud-controller-manager:${{ env.VERSION }} + target: vngcloud-controller-manager + + - name: Build and push Docker image + env: + TARGET: vngcloud-cm-webhook + uses: docker/build-push-action@v5 + with: + context: . + push: true + build-args: | + VERSION=${{ env.VERSION }} + platforms: linux/amd64 + outputs: type=registry + tags: | + ghcr.io/vngcloud/vngcloud-cm-webhook:${{ github.sha }} + ${{ env.REPO }}/vngcloud-cm-webhook:${{ github.sha }} + ${{ env.REPO }}/vngcloud-cm-webhook:${{ env.VERSION }} + target: vngcloud-cm-webhook + + - name: Build and push Docker image + env: + TARGET: vngcloud-ic-webhook + uses: docker/build-push-action@v5 + with: + context: . + push: true + build-args: | + VERSION=${{ env.VERSION }} + platforms: linux/amd64 + outputs: type=registry + tags: | + ghcr.io/vngcloud/vngcloud-ic-webhook:${{ github.sha }} + ${{ env.REPO }}/vngcloud-ic-webhook:${{ github.sha }} + ${{ env.REPO }}/vngcloud-ic-webhook:${{ env.VERSION }} + target: vngcloud-ic-webhook diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 7d6dbd0..713169f 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -13,14 +13,6 @@ env: jobs: build_package: runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - - image: vngcloud-ingress-controller - - image: vngcloud-controller-manager - - image: vngcloud-cm-webhook - - image: vngcloud-ic-webhook permissions: contents: write packages: write @@ -56,11 +48,59 @@ jobs: platforms: linux/amd64 outputs: type=registry tags: | - ghcr.io/vngcloud/${{ matrix.image }}:${{ github.sha }} - ghcr.io/vngcloud/${{ matrix.image }}:${{ github.ref_name }} - ${{ env.REPO }}/${{ matrix.image }}:${{ github.sha }} - ${{ env.REPO }}/${{ matrix.image }}:${{ github.ref_name }} - target: ${{ matrix.image }} + ghcr.io/vngcloud/vngcloud-ingress-controller:${{ github.sha }} + ghcr.io/vngcloud/vngcloud-ingress-controller:${{ github.ref_name }} + ${{ env.REPO }}/vngcloud-ingress-controller:${{ github.sha }} + ${{ env.REPO }}/vngcloud-ingress-controller:${{ github.ref_name }} + target: vngcloud-ingress-controller + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + build-args: | + VERSION=${{ github.ref_name }} + platforms: linux/amd64 + outputs: type=registry + tags: | + ghcr.io/vngcloud/vngcloud-controller-manager:${{ github.sha }} + ghcr.io/vngcloud/vngcloud-controller-manager:${{ github.ref_name }} + ${{ env.REPO }}/vngcloud-controller-manager:${{ github.sha }} + ${{ env.REPO }}/vngcloud-controller-manager:${{ github.ref_name }} + target: vngcloud-controller-manager + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + build-args: | + VERSION=${{ github.ref_name }} + platforms: linux/amd64 + outputs: type=registry + tags: | + ghcr.io/vngcloud/vngcloud-cm-webhook:${{ github.sha }} + ghcr.io/vngcloud/vngcloud-cm-webhook:${{ github.ref_name }} + ${{ env.REPO }}/vngcloud-cm-webhook:${{ github.sha }} + ${{ env.REPO }}/vngcloud-cm-webhook:${{ github.ref_name }} + target: vngcloud-cm-webhook + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + build-args: | + VERSION=${{ github.ref_name }} + platforms: linux/amd64 + outputs: type=registry + tags: | + ghcr.io/vngcloud/vngcloud-ic-webhook:${{ github.sha }} + ghcr.io/vngcloud/vngcloud-ic-webhook:${{ github.ref_name }} + ${{ env.REPO }}/vngcloud-ic-webhook:${{ github.sha }} + ${{ env.REPO }}/vngcloud-ic-webhook:${{ github.ref_name }} + target: vngcloud-ic-webhook create_release: runs-on: ubuntu-latest