feat: close db conn after query (#38) #24
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: Create and publish SSO Aggregator | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
paths: | |
- aggregator/** | |
- helm/aggregator/** | |
- .github/workflows/publish-aggregator.yml | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: The target environment | |
required: true | |
options: [sandbox, production] | |
env: | |
GITHUB_REGISTRY: ghcr.io | |
IMAGE_NAME: bcgov/sso-aggregator | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: hmarr/debug-action@v2 | |
- uses: actions/checkout@v3 | |
- name: Setup Tools | |
uses: ./.github/actions/setup-tools | |
- name: Log in to the GitHub Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.GITHUB_REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=ref,event=branch | |
type=sha,format=long | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: aggregator | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Set env to Sandbox | |
if: | | |
(github.ref == 'refs/heads/dev' && github.event_name == 'push') || | |
(github.event.inputs.environment == 'sandbox' && github.event_name == 'workflow_dispatch') | |
run: | | |
cat >> $GITHUB_ENV <<EOF | |
OPENSHIFT_TOKEN=${{ secrets.SANDBOX_OPENSHIFT_TOKEN }} | |
OPENSHIFT_SERVER=${{ secrets.SANDBOX_OPENSHIFT_SERVER }} | |
OPENSHIFT_NAMESPACE=${{ secrets.SANDBOX_OPENSHIFT_NAMESPACE }} | |
EOF | |
- name: Set env to Production | |
if: | | |
(github.ref == 'refs/heads/main' && github.event_name == 'push') || | |
(github.event.inputs.environment == 'production' && github.event_name == 'workflow_dispatch') | |
run: | | |
cat >> $GITHUB_ENV <<EOF | |
OPENSHIFT_TOKEN=${{ secrets.PROD_OPENSHIFT_TOKEN }} | |
OPENSHIFT_SERVER=${{ secrets.PROD_OPENSHIFT_SERVER }} | |
OPENSHIFT_NAMESPACE=${{ secrets.PROD_OPENSHIFT_NAMESPACE }} | |
EOF | |
- name: Authenticate and set context | |
uses: redhat-actions/oc-login@v1 | |
with: | |
openshift_server_url: ${{ env.OPENSHIFT_SERVER }} | |
openshift_token: ${{ env.OPENSHIFT_TOKEN }} | |
namespace: ${{ env.OPENSHIFT_NAMESPACE }} | |
insecure_skip_tls_verify: true | |
- name: Deploy aggregator with Helm chart | |
run: | | |
namespace=${{ env.OPENSHIFT_NAMESPACE }} | |
make upgrade NAMESPACE=${{ env.OPENSHIFT_NAMESPACE }} IMAGE_TAG=sha-${{ github.sha }} | |
working-directory: ./helm/aggregator |