Merge pull request #1378 from bcgov/test #949
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: Build and Deploy GH Pages | |
on: | |
push: | |
branches: | |
- dev | |
- test | |
- main | |
paths: | |
- '.github/**' | |
- 'app/**' | |
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 }} | |
strategy: | |
matrix: | |
env: ['sandbox', 'prod', 'preview'] | |
steps: | |
- name: Set env to sandbox | |
if: endsWith(github.ref, '/dev') && matrix.env == 'sandbox' | |
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=false | |
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') && matrix.env == '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=false | |
INCLUDE_DIGITAL_CREDENTIAL=true | |
INCLUDE_BC_SERVICES_CARD=true | |
ALLOW_BC_SERVICES_CARD_PROD=true | |
EOF | |
- name: Set env to preview | |
if: endsWith(github.ref, '/test') && matrix.env == 'preview' | |
run: | | |
cat >> $GITHUB_ENV <<EOF | |
APP_ENV=test | |
APP_URL=https://bcgov.github.io/sso-requests-preview | |
APP_BASE_PATH=/sso-requests-preview | |
API_URL=https://kcbkts0s8a.execute-api.ca-central-1.amazonaws.com/test/app/ | |
SSO_URL=https://test.loginproxy.gov.bc.ca/auth/realms/standard | |
DEPLOY_REPO_NAME=bcgov/sso-requests-preview | |
ENABLE_GOLD=true | |
MAINTENANCE_MODE_ACTIVE=false | |
INCLUDE_DIGITAL_CREDENTIAL=true | |
INCLUDE_BC_SERVICES_CARD=true | |
ALLOW_BC_SERVICES_CARD_PROD=false | |
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 }} | |
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 | |
- name: Create Release | |
if: github.ref == 'refs/heads/main' && matrix.env == 'prod' | |
id: release | |
uses: rymndhng/[email protected] | |
with: | |
bump_version_scheme: 'patch' | |
tag_prefix: 'v' | |
use_github_release_notes: 'true' | |
release_name: 'Release <RELEASE_VERSION>' | |
max_commits: 100 # default is 50 | |
- name: Check Output Parameters | |
if: github.ref == 'refs/heads/main' && matrix.env == 'prod' | |
run: | | |
echo "Got tag name ${{ steps.release.outputs.tag_name }}" | |
echo "Got release version ${{ steps.release.outputs.version }}" | |
echo "Upload release artifacts to ${{ steps.release.outputs.upload_url }}" |