OpenShift Build and Deploy to Web #107
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
# Build and Deploy to dev env. | |
# Trigger with tag dev | |
# Connected with repo environment 'dev' | |
name: OpenShift Build and Deploy to Web | |
on: | |
workflow_dispatch: | |
env: | |
CLUSTER: https://api.silver.devops.gov.bc.ca:6443 | |
AUTH_TOKEN: ${{ secrets.AUTH_TOKEN_OCP4 }} | |
BUILD_REF: ${{ github.base_ref }} | |
ENV_PREFIX: dev | |
NAMESPACE_DEV: ${{ vars.NAMESPACE_DEV }} | |
SOAM_CLIENT_ID_DEV: ${{ vars.SOAM_CLIENT_ID_DEV }} | |
SOAM_CLIENT_SECRET_DEV: ${{ secrets.SOAM_CLIENT_SECRET_DEV }} | |
PUBLIC_HOST: dev.independentschoolservices.gov.bc.ca | |
PROJECT_NAME: ecc-iosas | |
jobs: | |
web: | |
name: OpenShift Build & Deploy | |
runs-on: ubuntu-latest | |
concurrency: ci-build-web | |
timeout-minutes: 20 | |
environment: | |
name: dev | |
env: | |
CERTIFICATE: ${{ secrets.CERT }} | |
CA_CERT: ${{ secrets.CA_CERT }} | |
PRIVATE_KEY: ${{ secrets.PRIV_KEY }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
filters: | | |
src: | |
- 'frontend/**' | |
base: ${{ github.ref }} | |
- name: Build changes | |
if: steps.changes.outputs.src == 'true' | |
working-directory: './tools' | |
run: | | |
oc login --token="$AUTH_TOKEN" --server="$CLUSTER" | |
make print-status | |
make build-web | |
- name: Check changes on dir | |
uses: dorny/paths-filter@v2 | |
id: changes_tools | |
with: | |
filters: | | |
src: | |
- 'frontend/**' | |
base: ${{ github.ref }} | |
- name: Deploy changes | |
if: steps.changes_tools.outputs.src == 'true' | |
working-directory: './tools' | |
run: | | |
oc login --token="$AUTH_TOKEN" --server="$CLUSTER" | |
make print-status | |
make promote-web | |
make deploy-web | |
- name: Create Route | |
working-directory: './tools' | |
run: | | |
oc login --token="$AUTH_TOKEN" --server="$CLUSTER" | |
echo Creating route with ${{ env.PUBLIC_HOST }} | |
oc --namespace=${{ env.NAMESPACE_DEV }} process -f openshift/public-route.yml \ | |
-p NAME=web-ecc-iosas \ | |
-p PUBLIC_HOST=${{ env.PUBLIC_HOST }} \ | |
-p CERTIFICATE="${{ secrets.CERT }}" \ | |
-p CA_CERT="${{ secrets.CA_CERT }}" \ | |
-p PRIVATE_KEY="${{ secrets.PRIV_KEY }}" | oc --namespace=${{ env.NAMESPACE_DEV }} apply -f - |