Skip to content

Commit

Permalink
Split CPU API and UI GitHub Actions into separate workflows (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajdeziel authored Nov 22, 2024
1 parent ea08092 commit 20c3119
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 39 deletions.
47 changes: 8 additions & 39 deletions .github/workflows/cd-cpu.yml → .github/workflows/cd-cpu-api.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
49 changes: 49 additions & 0 deletions .github/workflows/cd-cpu-ui.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 20c3119

Please sign in to comment.