lookup secret. #33
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy of Job on Pull Request to Main | |
on: | |
pull_request: | |
branches: | |
- main | |
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: . | |
- package: nr-oracle-service-init | |
build_file: Dockerfile.certs | |
build_context: . | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: bcgov-nr/[email protected] | |
with: | |
package: ${{ matrix.package }} | |
tag: ${{ github.sha }} | |
tag_fallback: test | |
token: ${{ secrets.GITHUB_TOKEN }} | |
build_file: ${{ matrix.build_file }} | |
build_context: ${{ matrix.build_context }} | |
deploys: | |
name: Deploys | |
needs: | |
- builds | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- 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=${{ github.sha }} --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 }} --namespace ${{ vars.oc_namespace }} --timeout 10m charts/nr-oracle-service --debug |