Skip to content

Commit

Permalink
🚀 change: improve CI flow
Browse files Browse the repository at this point in the history
  • Loading branch information
anngdinh committed Jul 20, 2024
1 parent 8d2a60f commit 71f5b74
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 25 deletions.
69 changes: 57 additions & 12 deletions .github/workflows/ci-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: .
Expand All @@ -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
66 changes: 53 additions & 13 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 71f5b74

Please sign in to comment.