Exported the sql statement for views #841
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
# Static Deploy On OpensShift | |
# Builds and Deploys merged PR's to persistent pods/services/routes/etc in the OpenShift Dev environment. | |
name: Static Deploy on OpensShift | |
on: | |
pull_request: | |
types: [opened, reopened, synchronize, closed] | |
branches: | |
- dev | |
- prod | |
jobs: | |
# Print variables for logging and debugging purposes | |
checkEnv: | |
name: Check Env variables | |
runs-on: ubuntu-latest | |
steps: | |
- name: Print Env Vars | |
run: | | |
echo Git Base Ref: ${{ github.base_ref }} | |
echo Git Build ID: ${{ github.event.number }} | |
echo Git Pull Request Ref: ${{ github.event.pull_request.head.sha }} | |
echo OC CLI Version: $(oc version) | |
# Build the API | |
buildAPI: | |
name: Build API Static | |
runs-on: ubuntu-latest | |
if: ${{ github.event.pull_request.merged == true}} | |
env: | |
BUILD_ID: ${{ github.event.number }} | |
steps: | |
# Checkout the PR branch | |
- name: Checkout Target Branch | |
uses: actions/checkout@v2 | |
# Install Node - for `node` and `npm` commands | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 10.16 | |
# Log in to OpenShift. | |
# Note: The secrets needed to log in are NOT available if the PR comes from a FORK. | |
# PR's must originate from a branch off the original repo or else all openshift `oc` commands will fail. | |
- name: Log in to OpenShift | |
run: oc login --token=${{secrets.TOOLS_SA_TOKEN}} --server=https://api.silver.devops.gov.bc.ca:6443 | |
# Build the api images | |
- name: Build API Images | |
working-directory: "./api/.pipeline/" | |
run: | | |
npm ci | |
DEBUG=* npm run build -- --pr=$BUILD_ID --branch=${{ github.base_ref }} --type=static | |
# Build the web frontend app | |
buildAPP: | |
name: Build App Static | |
runs-on: ubuntu-latest | |
if: ${{ github.event.pull_request.merged == true}} | |
env: | |
BUILD_ID: ${{ github.event.number }} | |
steps: | |
# Checkout the PR branch | |
- name: Checkout Target Branch | |
uses: actions/checkout@v2 | |
# Install Node - for `node` and `npm` commands | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 10.16 | |
# Log in to OpenShift. | |
# Note: The secrets needed to log in are NOT available if the PR comes from a FORK. | |
# PR's must originate from a branch off the original repo or else all openshift `oc` commands will fail. | |
- name: Log in to OpenShift | |
run: oc login --token=${{ secrets.TOOLS_SA_TOKEN }} --server=https://api.silver.devops.gov.bc.ca:6443 | |
# Build the app images | |
- name: Build APP Images | |
working-directory: "./app/.pipeline/" | |
run: | | |
npm ci | |
DEBUG=* npm run build -- --pr=$BUILD_ID --branch=${{ github.base_ref }} --type=static | |
# End buildAPP | |
# Deploy App, API images in Dev | |
deployDev: | |
name: Deploy App, API to DEV environment | |
runs-on: ubuntu-latest | |
if: ${{ github.event.pull_request.merged == true && github.base_ref != 'prod'}} | |
env: | |
BUILD_ID: ${{ github.event.number }} | |
needs: | |
- buildAPI | |
- buildAPP | |
steps: | |
# Checkout the PR branch | |
- name: Checkout Target Branch | |
uses: actions/checkout@v2 | |
# Install Node - for `node` and `npm` commands | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 10.16 | |
# Log in to OpenShift. | |
# Note: The secrets needed to log in are NOT available if the PR comes from a FORK. | |
# PR's must originate from a branch off the original repo or else all openshift `oc` commands will fail. | |
- name: Log in to OpenShift | |
run: oc login --token=${{ secrets.TOOLS_SA_TOKEN }} --server=https://api.silver.devops.gov.bc.ca:6443 | |
# Deploy the api | |
- name: Deploy API | |
working-directory: "./api/.pipeline/" | |
run: | | |
npm ci | |
DEBUG=* npm run pre-deploy -- --pr=$BUILD_ID --env=dev --type=static --branch=${{ github.base_ref }} | |
DEBUG=* npm run setup -- --pr=$BUILD_ID --env=dev --type=static --branch=${{ github.base_ref }} | |
DEBUG=* npm run seed -- --pr=$BUILD_ID --env=dev --type=static --branch=${{ github.base_ref }} | |
DEBUG=* npm run deploy -- --pr=$BUILD_ID --env=dev --type=static --branch=${{ github.base_ref }} | |
DEBUG=* npm run deploy-tools -- --pr=$BUILD_ID --env=dev --type=static --branch=${{ github.base_ref }} | |
# Deploy the app | |
- name: Deploy App | |
working-directory: "./app/.pipeline" | |
run: | | |
npm ci | |
DEBUG=* npm run deploy -- --pr=$BUILD_ID --env=dev --type=static --branch=${{ github.base_ref }} | |
# Deploy App, API images in Test | |
deployTest: | |
name: Deploy App, API to TEST environment | |
runs-on: ubuntu-latest | |
if: ${{ github.event.pull_request.merged == true && github.base_ref != 'prod'}} | |
env: | |
BUILD_ID: ${{ github.event.number }} | |
needs: | |
- buildAPI | |
- buildAPP | |
steps: | |
# Checkout the PR branch | |
- name: Checkout Target Branch | |
uses: actions/checkout@v2 | |
# Install Node - for `node` and `npm` commands | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 10.16 | |
# Log in to OpenShift. | |
# Note: The secrets needed to log in are NOT available if the PR comes from a FORK. | |
# PR's must originate from a branch off the original repo or else all openshift `oc` commands will fail. | |
- name: Log in to OpenShift | |
run: oc login --token=${{ secrets.TOOLS_SA_TOKEN }} --server=https://api.silver.devops.gov.bc.ca:6443 | |
# Deploy the api | |
- name: Deploy API | |
working-directory: "./api/.pipeline/" | |
run: | | |
npm ci | |
DEBUG=* npm run pre-deploy -- --pr=$BUILD_ID --env=test --type=static --branch=${{ github.base_ref }} | |
DEBUG=* npm run setup -- --pr=$BUILD_ID --env=test --type=static --branch=${{ github.base_ref }} | |
DEBUG=* npm run seed -- --pr=$BUILD_ID --env=test --type=static --branch=${{ github.base_ref }} | |
DEBUG=* npm run deploy -- --pr=$BUILD_ID --env=test --type=static --branch=${{ github.base_ref }} | |
DEBUG=* npm run deploy-tools -- --pr=$BUILD_ID --env=test --type=static --branch=${{ github.base_ref }} | |
# Deploy the app | |
- name: Deploy App | |
working-directory: "./app/.pipeline" | |
run: | | |
npm ci | |
DEBUG=* npm run deploy -- --pr=$BUILD_ID --env=test --type=static --branch=${{ github.base_ref }} | |
# Deploy App, API images in Prod | |
deployProd: | |
name: Deploy App, API to PROD environment | |
runs-on: ubuntu-latest | |
if: ${{ github.event.pull_request.merged == true && github.base_ref == 'prod'}} | |
env: | |
BUILD_ID: ${{ github.event.number }} | |
needs: | |
- buildAPI | |
- buildAPP | |
steps: | |
# Checkout the PR branch | |
- name: Checkout Target Branch | |
uses: actions/checkout@v2 | |
# Install Node - for `node` and `npm` commands | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 10.16 | |
# Log in to OpenShift. | |
# Note: The secrets needed to log in are NOT available if the PR comes from a FORK. | |
# PR's must originate from a branch off the original repo or else all openshift `oc` commands will fail. | |
- name: Log in to OpenShift | |
run: oc login --token=${{ secrets.TOOLS_SA_TOKEN }} --server=https://api.silver.devops.gov.bc.ca:6443 | |
# Deploy the api | |
- name: Deploy API | |
working-directory: "./api/.pipeline/" | |
run: | | |
npm ci | |
DEBUG=* npm run pre-deploy -- --pr=$BUILD_ID --env=prod --type=static --branch=${{ github.base_ref }} | |
DEBUG=* npm run setup -- --pr=$BUILD_ID --env=prod --type=static --branch=${{ github.base_ref }} | |
DEBUG=* npm run deploy -- --pr=$BUILD_ID --env=prod --type=static --branch=${{ github.base_ref }} | |
DEBUG=* npm run deploy-tools -- --pr=$BUILD_ID --env=prod --type=static --branch=${{ github.base_ref }} | |
# Deploy the app | |
- name: Deploy App | |
working-directory: "./app/.pipeline" | |
run: | | |
npm ci | |
DEBUG=* npm run deploy -- --pr=$BUILD_ID --env=prod --type=static --branch=${{ github.base_ref }} | |
# Deploy App, API images and related build/deployment artifacts | |
clean: | |
name: Clean Deployment Artifacts for App, API in DEV and Test environments | |
runs-on: ubuntu-latest | |
if: ${{ github.event.pull_request.merged == true && github.base_ref == 'dev' }} | |
needs: | |
- buildAPI | |
- buildAPP | |
- deployDev | |
- deployTest | |
env: | |
BUILD_ID: ${{ github.event.number }} | |
steps: | |
# Checkout the PR branch | |
- name: Checkout Target Branch | |
uses: actions/checkout@v2 | |
# Install Node - for `node` and `npm` commands | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 10.16 | |
# Log in to OpenShift. | |
# Note: The secrets needed to log in are NOT available if the PR comes from a FORK. | |
# PR's must originate from a branch off the original repo or else all openshift `oc` commands will fail. | |
- name: Log in to OpenShift | |
run: oc login --token=${{ secrets.TOOLS_SA_TOKEN }} --server=https://api.silver.devops.gov.bc.ca:6443 | |
# Clean the api deployment artifacts | |
- name: Clean API Deployment | |
working-directory: "./api/.pipeline/" | |
run: | | |
npm ci | |
DEBUG=* npm run clean -- --pr=$BUILD_ID --env=build | |
DEBUG=* npm run clean -- --pr=$BUILD_ID --env=dev | |
# Clean the app deployment artifacts | |
- name: Clean APP Deployment | |
working-directory: "./app/.pipeline/" | |
run: | | |
npm ci | |
DEBUG=* npm run clean -- --pr=$BUILD_ID --env=build | |
DEBUG=* npm run clean -- --pr=$BUILD_ID --env=dev | |
# Clean App, API images and related build/deployment artifacts | |
cleanProd: | |
name: Clean Deployment Artifacts for App, API in PROD environment | |
runs-on: ubuntu-latest | |
if: ${{ github.event.pull_request.merged == true && github.base_ref == 'prod' }} | |
needs: | |
- buildAPI | |
- buildAPP | |
- deployProd | |
env: | |
BUILD_ID: ${{ github.event.number }} | |
steps: | |
# Checkout the PR branch | |
- name: Checkout Target Branch | |
uses: actions/checkout@v2 | |
# Install Node - for `node` and `npm` commands | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 10.16 | |
# Log in to OpenShift. | |
# Note: The secrets needed to log in are NOT available if the PR comes from a FORK. | |
# PR's must originate from a branch off the original repo or else all openshift `oc` commands will fail. | |
- name: Log in to OpenShift | |
run: oc login --token=${{ secrets.TOOLS_SA_TOKEN }} --server=https://api.silver.devops.gov.bc.ca:6443 | |
# Clean the api deployment artifacts | |
- name: Clean API Deployment | |
working-directory: "./api/.pipeline/" | |
run: | | |
npm ci | |
DEBUG=* npm run clean -- --pr=$BUILD_ID --env=build | |
DEBUG=* npm run clean -- --pr=$BUILD_ID --env=dev | |
# Clean the app deployment artifacts | |
- name: Clean APP Deployment | |
working-directory: "./app/.pipeline/" | |
run: | | |
npm ci | |
DEBUG=* npm run clean -- --pr=$BUILD_ID --env=build | |
DEBUG=* npm run clean -- --pr=$BUILD_ID --env=dev |