Merge pull request #38 from bcgov/dev #9
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: Deploy Test Environment | |
on: | |
push: | |
tags: | |
- v*.*.* | |
env: | |
GITHUB_REGISTRY: ghcr.io | |
IMAGE_NAME_FRONTEND: bcgov/strdss-frontend | |
IMAGE_NAME_BACKEND: bcgov/strdss-backend | |
jobs: | |
build-frontend: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 10 | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: hmarr/debug-action@a701ed95a46e6f2fb0df25e1a558c16356fae35a | |
- uses: actions/checkout@96f53100ba2a5449eb71d2e6604bbcd94b9449b5 | |
- name: Setup Tools | |
uses: ./.github/actions/setup-tools | |
# - name: Replace STYLE_NONCE in vite.config.ts | |
# run: | | |
# sed -i "s/__STYLE_NONCE__/$(echo -n ${{ github.sha }} | base64)/" frontend/vite.config.ts | |
- name: Build and Push | |
uses: egose/actions/docker-build-push@04830c07edee3c552f2c5a0330a674ff0d366c66 | |
with: | |
registry-url: ${{ env.GITHUB_REGISTRY }} | |
registry-username: ${{ github.actor }} | |
registry-password: ${{ secrets.GITHUB_TOKEN }} | |
image-name: ${{ env.IMAGE_NAME_FRONTEND }} | |
docker-context: frontend | |
docker-file: frontend/Dockerfile | |
metadata-tags: | | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
build-backend: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 10 | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: hmarr/debug-action@a701ed95a46e6f2fb0df25e1a558c16356fae35a | |
- uses: actions/checkout@96f53100ba2a5449eb71d2e6604bbcd94b9449b5 | |
- name: Setup Tools | |
uses: ./.github/actions/setup-tools | |
- name: Build and Push | |
uses: egose/actions/docker-build-push@04830c07edee3c552f2c5a0330a674ff0d366c66 | |
with: | |
registry-url: ${{ env.GITHUB_REGISTRY }} | |
registry-username: ${{ github.actor }} | |
registry-password: ${{ secrets.GITHUB_TOKEN }} | |
image-name: ${{ env.IMAGE_NAME_BACKEND }} | |
docker-context: server | |
docker-file: server/Dockerfile | |
metadata-tags: | | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
deploy: | |
needs: [build-frontend, build-backend] | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 5 | |
permissions: | |
contents: read | |
environment: | |
name: test | |
url: https://test-strdss.f4a30d-dev.apps.silver.devops.gov.bc.ca/ | |
steps: | |
- uses: hmarr/debug-action@a701ed95a46e6f2fb0df25e1a558c16356fae35a | |
- uses: actions/checkout@96f53100ba2a5449eb71d2e6604bbcd94b9449b5 | |
with: | |
ref: main # one source of truth for CI/CD pipeline | |
- name: Authenticate and set context | |
uses: redhat-actions/oc-login@9b79eb6d8ec51bce42cb4e77f0a174fc80cf3cb9 | |
with: | |
openshift_server_url: ${{ secrets.OPENSHIFT_SERVER }} | |
openshift_token: ${{ secrets.OPENSHIFT_TOKEN }} | |
namespace: f4a30d-dev # dev and test live in the same 'DEV' namespace | |
insecure_skip_tls_verify: true | |
- name: Deploy apps with Helm chart | |
run: | | |
vtag=${{ github.ref_name }} | |
make upgrade \ | |
NAMESPACE=f4a30d-dev \ | |
NAME=strdss-test \ | |
ENV_NAME=test \ | |
IMAGE_TAG_FRONTEND=${vtag//v} \ | |
IMAGE_TAG_BACKEND=${vtag//v} \ | |
working-directory: ./helm/main |