Skip to content

Merge pull request #688 from bcgov/yj #610

Merge pull request #688 from bcgov/yj

Merge pull request #688 from bcgov/yj #610

Workflow file for this run

name: Deploy Dev Environment
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- database/**
- package.json
- package-lock.json
- CHANGELOG.md
- .conventional-changelog.mjs
- .release-it.json
- postman/**
- localdb/**
- postgres/**
- crunchydb/**
- backup-container/**
- gateway/**
jobs:
test-backend:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.400'
- name: Test backend
run: dotnet test ./server/server.sln
test-frontend:
runs-on: ubuntu-22.04
timeout-minutes: 10
permissions:
contents: read
packages: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- run: |
cd ./frontend
npm install -g @angular/cli
npm install
ng build --configuration=production
ng test --watch=false --progress=false --browsers=ChromeHeadless --code-coverage --source-map=false
continue-on-error: true
docker-build-backend:
runs-on: ubuntu-22.04
timeout-minutes: 10
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Setup Tools
uses: ./.github/actions/setup-tools
- name: Build Docker image
run: cd server && docker build -t strdss-backend -f Dockerfile .
- name: Tag Docker image
run: docker tag strdss-backend artifacts.developer.gov.bc.ca/sf4a-strdss/strdss-backend:dev
- name: Push Docker image to Artifactory
run: |
docker login artifacts.developer.gov.bc.ca -u ${{ secrets.JFROG_USERNAME }} -p ${{ secrets.JFROG_PASSWORD }}
docker push artifacts.developer.gov.bc.ca/sf4a-strdss/strdss-backend:dev
docker-build-hangfire:
runs-on: ubuntu-22.04
timeout-minutes: 10
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Setup Tools
uses: ./.github/actions/setup-tools
- name: Build Docker image
run: cd server && docker build -t strdss-hangfire -f Dockerfile.hangfire .
- name: Tag Docker image
run: docker tag strdss-hangfire artifacts.developer.gov.bc.ca/sf4a-strdss/strdss-hangfire:dev
- name: Push Docker image to Artifactory
run: |
docker login artifacts.developer.gov.bc.ca -u ${{ secrets.JFROG_USERNAME }} -p ${{ secrets.JFROG_PASSWORD }}
docker push artifacts.developer.gov.bc.ca/sf4a-strdss/strdss-hangfire:dev
docker-build-frontend:
runs-on: ubuntu-22.04
timeout-minutes: 10
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Setup Tools
uses: ./.github/actions/setup-tools
- name: Render style_nonce
id: render_style_nonce
run: echo "::set-output name=style_nonce::$(echo -n ${{ github.sha }} | base64)"
- name: Build Docker image
run: cd frontend && docker build -t strdss-frontend -f Dockerfile .
- name: Tag Docker image
run: docker tag strdss-frontend artifacts.developer.gov.bc.ca/sf4a-strdss/strdss-frontend:dev
- name: Push Docker image to Artifactory
run: |
docker login artifacts.developer.gov.bc.ca -u ${{ secrets.JFROG_USERNAME }} -p ${{ secrets.JFROG_PASSWORD }}
docker push artifacts.developer.gov.bc.ca/sf4a-strdss/strdss-frontend:dev
deploy-emerald:
needs: [test-frontend, test-backend, docker-build-frontend, docker-build-backend, docker-build-hangfire]
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- name: Checkout ArgoCD Repo
id: gitops
uses: actions/checkout@v4
with:
repository: bcgov-c/tenant-gitops-b0471a
ref: develop
token: ${{ secrets.GITOPS }} # `GITOPS` is a secret that contains your PAT
- name: Update Helm Values and Commit backend
id: helm
run: |
pwd
# Get current date and time
DATETIME=$(date +'%Y-%m-%d %H:%M:%S')
# set image tag
sed -i "s/tag: .*/tag: dev # Image Updated on $DATETIME/" deploy/dev_values.yaml
# Commit and push the changes
git config --global user.email "ychung-mot@github.com"
git config --global user.name "Young-Jin Chung"
git add deploy/dev_values.yaml
pwd
# Repackage Helm Chart
cd charts/gitops/charts
helm package ../../frontend/
helm package ../../backend/
helm package ../../hangfire/
git add .
git commit -m "Update image tag to dev on $DATETIME"
git push origin develop