Skip to content

chore(deps): update bcgov-nr/action-builder-ghcr action to v2 #86

chore(deps): update bcgov-nr/action-builder-ghcr action to v2

chore(deps): update bcgov-nr/action-builder-ghcr action to v2 #86

Workflow file for this run

name: Build and Deploy of Job on Pull Request to Main
on:
pull_request:
branches:
- main
paths-ignore:
- 'charts/**'
concurrency:
# PR open and close use the same group, allowing only one at a time
group: pr-${{ github.workflow }}-${{ github.event.number }}
cancel-in-progress: true
jobs:
builds:
name: Builds
if: '!github.event.pull_request.head.repo.fork'
runs-on: ubuntu-22.04
permissions:
packages: write
strategy:
matrix:
package: [nr-oracle-service, nr-oracle-service-init]
include:
- package: nr-oracle-service
build_file: Dockerfile
build_context: .
triggers: ('src/' 'pom.xml')
- package: nr-oracle-service-init
build_file: Dockerfile.certs
build_context: .
triggers: ('get_certs.sh' 'Dockerfile.certs')
steps:
- uses: actions/checkout@v4
- uses: bcgov-nr/[email protected]
with:
package: ${{ matrix.package }}
tag: ${{ github.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
build_file: ${{ matrix.build_file }}
build_context: ${{ matrix.build_context }}
triggers: ${{ matrix.triggers }}
- uses: shrink/actions-docker-registry-tag@v3
with:
registry: ghcr.io
repository: ${{ github.repository }}/${{ matrix.package }}
target: ${{ github.sha }}
tags: pr-${{ github.event.number }}
deploys:
name: Deploys
needs:
- builds
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Deploy to OpenShift
shell: bash
run: |
# Allow pipefail, since we could be catching oc create errors
set +o pipefail
# Login to OpenShift (NOTE: project command is a safeguard)
oc login --token=${{ secrets.oc_token }} --server=${{ vars.oc_server }}
oc project ${{ vars.oc_namespace }}
# Deploy Helm Chart
helm upgrade --install --wait --atomic nr-oracle-service-${{ github.event.number }} --set nameOverride=nr-oracle-service-${{ github.event.number }} --set image.tag=pr-${{ github.event.number }} --set app.envs.DB_HOST=${{ secrets.DB_HOST }} --set app.envs.DB_NAME=${{ secrets.DB_NAME }} --set app.envs.DB_PASSWORD=${{ secrets.DB_PASSWORD }} --set app.envs.DB_USER=${{ secrets.DB_USER }} --set image.repository=ghcr.io/${{ github.repository }}/nr-oracle-service --set image.repositoryInit=ghcr.io/${{ github.repository }}/nr-oracle-service-init --set namespace=${{ vars.oc_namespace }} --timeout 10m charts/nr-oracle-service --debug