From 20c3119b4c2359fe85b4a4a93c74a13ae94e6ad7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?AJ=20Po-D=C3=A9ziel?= Date: Fri, 22 Nov 2024 14:57:50 -0800 Subject: [PATCH] Split CPU API and UI GitHub Actions into separate workflows (#88) --- .../workflows/{cd-cpu.yml => cd-cpu-api.yaml} | 47 +++--------------- .github/workflows/cd-cpu-ui.yaml | 49 +++++++++++++++++++ 2 files changed, 57 insertions(+), 39 deletions(-) rename .github/workflows/{cd-cpu.yml => cd-cpu-api.yaml} (53%) create mode 100644 .github/workflows/cd-cpu-ui.yaml diff --git a/.github/workflows/cd-cpu.yml b/.github/workflows/cd-cpu-api.yaml similarity index 53% rename from .github/workflows/cd-cpu.yml rename to .github/workflows/cd-cpu-api.yaml index 118edb2..981c734 100644 --- a/.github/workflows/cd-cpu.yml +++ b/.github/workflows/cd-cpu-api.yaml @@ -1,11 +1,15 @@ -name: cd-cpu-app +name: cd-cpu-api on: workflow_dispatch: push: - paths: - - 'cpu-app/**' - - '.github/workflows/cd-cpu.yml' + paths-ignore: + - '.github/workflows/cd-restitution-ui.yml' + - 'COMPLIANCE.yaml' + - 'CPU.postman_collection.json' + - 'dependabot.yml' + - 'LICENSE' + - 'README.md' env: APP_NAME: cpu @@ -47,38 +51,3 @@ jobs: push: true tags: | ${{ env.IMAGE_REGISTRY }}/${{ env.APP_NAME }}-${{ env.IMAGE_NAME }}:dev - - build-cpu-ui: - runs-on: ubuntu-latest - if: github.repository_owner == 'bcgov' - env: - IMAGE_NAME: ui - CPU_UI_DOCKERFILE_PATH: ./cpu-app/ClientApp/Dockerfile - - steps: - - uses: actions/checkout@v4 - - - name: Set up Docker Buildx tooling - uses: docker/setup-buildx-action@v3 - - - name: Log into OpenShift Registry - uses: docker/login-action@v3 - with: - registry: ${{ env.IMAGE_REGISTRY }} - username: ${{ secrets.OCP4_USERNAME }} - password: ${{ secrets.OCP4_PASSWORD }} - - - name: Pull image - run: docker pull $IMAGE_ID || true - - - name: Build and push cpu-app - uses: docker/build-push-action@v6 - with: - build-args: | - BUILD_ID="${{ env.BUILD_ID }}" - cache-from: | - ${{ env.IMAGE_REGISTRY }}/${{ env.APP_NAME }}-${{ env.IMAGE_NAME }} - file: ${{ env.CPU_UI_DOCKERFILE_PATH }} - push: true - tags: | - ${{ env.IMAGE_REGISTRY }}/${{ env.APP_NAME }}-${{ env.IMAGE_NAME }}:dev diff --git a/.github/workflows/cd-cpu-ui.yaml b/.github/workflows/cd-cpu-ui.yaml new file mode 100644 index 0000000..9ab754f --- /dev/null +++ b/.github/workflows/cd-cpu-ui.yaml @@ -0,0 +1,49 @@ +name: cd-cpu-ui + +on: + workflow_dispatch: + push: + paths: + - 'cpu-app/ClientApp/**' + - '.github/workflows/cd-cpu-ui.yml' + +env: + APP_NAME: cpu + BUILD_ID: ${{ github.server_url }}!${{ github.repository }}!${{ github.ref_name }}!${{ github.sha }}!${{ github.run_number }} + IMAGE_REGISTRY: ${{ secrets.OCP4_REGISTRY }}/${{ secrets.OCP4_NAMESPACE }} + +jobs: + build-cpu-ui: + runs-on: ubuntu-latest + if: github.repository_owner == 'bcgov' + env: + IMAGE_NAME: ui + CPU_UI_DOCKERFILE_PATH: ./cpu-app/ClientApp/Dockerfile + + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx tooling + uses: docker/setup-buildx-action@v3 + + - name: Log into OpenShift Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.IMAGE_REGISTRY }} + username: ${{ secrets.OCP4_USERNAME }} + password: ${{ secrets.OCP4_PASSWORD }} + + - name: Pull image + run: docker pull $IMAGE_ID || true + + - name: Build and push cpu-ui + uses: docker/build-push-action@v6 + with: + build-args: | + BUILD_ID="${{ env.BUILD_ID }}" + cache-from: | + ${{ env.IMAGE_REGISTRY }}/${{ env.APP_NAME }}-${{ env.IMAGE_NAME }} + file: ${{ env.CPU_UI_DOCKERFILE_PATH }} + push: true + tags: | + ${{ env.IMAGE_REGISTRY }}/${{ env.APP_NAME }}-${{ env.IMAGE_NAME }}:dev