bcgov/document-generation-showcase

View on GitHub
.github/workflows/on-push.yaml

Summary

Maintainability
Test Coverage
name: Push

env:
  ACRONYM: dgrsc
  APP_NAME: document-generation-showcase
  NAMESPACE_PREFIX: bb0279

on:
  push:
    branches:
      - master
    tags:
      - v*.*.*

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

jobs:
  build:
    name: Build & Push
    runs-on: ubuntu-latest
    timeout-minutes: 10
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Build & Push
        uses: ./.github/actions/build-push-container
        with:
          context: .
          image_name: ${{ env.APP_NAME }}
          github_username: ${{ github.repository_owner }}
          github_token: ${{ secrets.GITHUB_TOKEN }}
          dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
          dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}

  deploy-dev:
    name: Deploy to Dev
    environment:
      name: dev
      url: https://${{ env.ACRONYM }}-dev-master.apps.silver.devops.gov.bc.ca
    runs-on: ubuntu-latest
    needs: build
    timeout-minutes: 12
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Deploy to Dev
        uses: ./.github/actions/deploy-to-environment
        with:
          app_name: ${{ env.APP_NAME }}
          acronym: ${{ env.ACRONYM }}
          environment: dev
          job_name: master
          namespace_prefix: ${{ env.NAMESPACE_PREFIX }}
          namespace_environment: dev
          openshift_server: ${{ secrets.OPENSHIFT_SERVER }}
          openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}

  deploy-test:
    name: Deploy to Test
    environment:
      name: test
      url: https://${{ env.ACRONYM }}-test-master.apps.silver.devops.gov.bc.ca
    runs-on: ubuntu-latest
    needs:
      - build
      - deploy-dev
    timeout-minutes: 12
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Deploy to Test
        uses: ./.github/actions/deploy-to-environment
        with:
          app_name: ${{ env.APP_NAME }}
          acronym: ${{ env.ACRONYM }}
          environment: test
          job_name: master
          namespace_prefix: ${{ env.NAMESPACE_PREFIX }}
          namespace_environment: test
          openshift_server: ${{ secrets.OPENSHIFT_SERVER }}
          openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}

  deploy-prod:
    name: Deploy to Prod
    environment:
      name: prod
      url: https://${{ env.ACRONYM }}-prod-master.apps.silver.devops.gov.bc.ca
    runs-on: ubuntu-latest
    needs:
      - build
      - deploy-dev
      - deploy-test
    timeout-minutes: 12
    steps:
      - name: Checkout
        uses: actions/checkout@v4
      - name: Deploy to Prod
        uses: ./.github/actions/deploy-to-environment
        with:
          app_name: ${{ env.APP_NAME }}
          acronym: ${{ env.ACRONYM }}
          environment: prod
          job_name: master
          namespace_prefix: ${{ env.NAMESPACE_PREFIX }}
          namespace_environment: prod
          openshift_server: ${{ secrets.OPENSHIFT_SERVER }}
          openshift_token: ${{ secrets.OPENSHIFT_TOKEN }}