Skip to content

Build and Deploy GH Pages No Release #411

Build and Deploy GH Pages No Release

Build and Deploy GH Pages No Release #411

name: Build and Deploy GH Pages No Release
on:
workflow_dispatch:
inputs:
environment:
description: 'The target branch from which to deploy'
required: true
type: choice
options: ['dev', 'prod']
default: 'dev'
maintenanceEnabled:
description: 'If true, the CSS app will be in maintenance mode.'
type: boolean
required: false
default: false
env:
SSO_CLIENT_ID: css-app-in-gold-4128
DEPLOY_REPO_BRANCH: gh-pages
jobs:
build-and-deploy:
runs-on: ubuntu-20.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Set env to sandbox
if: ${{endsWith(github.ref,'/dev') && github.event.inputs.environment == 'dev' }}
run: |
cat >> $GITHUB_ENV <<EOF
APP_ENV=develop
APP_URL=https://bcgov.github.io/sso-requests-sandbox
APP_BASE_PATH=/sso-requests-sandbox
API_URL=https://gcp9dahm4c.execute-api.ca-central-1.amazonaws.com/test/app/
SSO_URL=https://dev.loginproxy.gov.bc.ca/auth/realms/standard
DEPLOY_REPO_NAME=bcgov/sso-requests-sandbox
ENABLE_GOLD=true
MAINTENANCE_MODE_ACTIVE=${{github.event.inputs.maintenanceEnabled}}
INCLUDE_DIGITAL_CREDENTIAL=true
INCLUDE_BC_SERVICES_CARD=true
ALLOW_BC_SERVICES_CARD_PROD=true
EOF
- name: Set env to production
if: ${{endsWith(github.ref,'/main') && github.event.inputs.environment == 'prod' }}
run: |
cat >> $GITHUB_ENV <<EOF
APP_ENV=production
APP_URL=https://bcgov.github.io/sso-requests
APP_BASE_PATH=/sso-requests
API_URL=https://kgodz1zmk2.execute-api.ca-central-1.amazonaws.com/test/app/
SSO_URL=https://loginproxy.gov.bc.ca/auth/realms/standard
DEPLOY_REPO_NAME=bcgov/sso-requests
ENABLE_GOLD=true
MAINTENANCE_MODE_ACTIVE=${{github.event.inputs.maintenanceEnabled}}
INCLUDE_BC_SERVICES_CARD=true
ALLOW_BC_SERVICES_CARD_PROD=true
EOF
- name: Checkout 🛎️
if: env.APP_ENV != ''
uses: actions/checkout@v4
- name: Install and Build
if: env.APP_ENV != ''
env:
APP_ENV: ${{ env.APP_ENV }}
APP_URL: ${{ env.APP_URL }}
APP_BASE_PATH: ${{ env.APP_BASE_PATH }}
API_URL: ${{ env.API_URL }}
SSO_URL: ${{ env.SSO_URL }}
SSO_CLIENT_ID: ${{ env.SSO_CLIENT_ID }}
MAINTENANCE_MODE_ACTIVE: ${{env.MAINTENANCE_MODE_ACTIVE}}
run: |
yarn
yarn build
yarn export
touch ./out/.nojekyll
working-directory: ./app
- name: Deploy 🚀
if: env.APP_ENV != ''
uses: JamesIves/[email protected]
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}
repository-name: ${{ env.DEPLOY_REPO_NAME }}
branch: ${{ env.DEPLOY_REPO_BRANCH }}
folder: ./app/out