Skip to content

Split CPU API and UI GitHub Actions into separate workflows (#88) #1

Split CPU API and UI GitHub Actions into separate workflows (#88)

Split CPU API and UI GitHub Actions into separate workflows (#88) #1

Workflow file for this run

name: cd-cpu-api
on:
workflow_dispatch:
push:
paths-ignore:
- '.github/workflows/cd-restitution-ui.yml'
- 'COMPLIANCE.yaml'
- 'CPU.postman_collection.json'
- 'dependabot.yml'
- 'LICENSE'
- 'README.md'
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-api:
runs-on: ubuntu-latest
if: github.repository_owner == 'bcgov'
env:
IMAGE_NAME: api
CPU_API_DOCKERFILE_PATH: ./cpu-app/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_API_DOCKERFILE_PATH }}
push: true
tags: |
${{ env.IMAGE_REGISTRY }}/${{ env.APP_NAME }}-${{ env.IMAGE_NAME }}:dev