Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- beta
- qa
- demo
- internal
basepath:
description: 'Server base path (without slashes) for serving the application (e.g., spa). If left blank, it will try to deploy to the root base path.'
type: string
Expand Down Expand Up @@ -101,6 +102,26 @@ jobs:
echo VITE_OIDC_STORAGE_KEY_PREFIX="$OIDC_STORAGE_KEY_PREFIX" >> .env
shell: bash

# For INTERNAL environment
- name: Create and populate .env file for INTERNAL
if: ${{ github.event.inputs.environment == 'internal' }}
env:
DATAVERSE_BACKEND_URL: ${{ secrets.INTERNAL_DATAVERSE_BACKEND_URL }}
OIDC_CLIENT_ID: ${{ secrets.INTERNAL_OIDC_CLIENT_ID }}
OIDC_AUTHORIZATION_ENDPOINT: ${{ INTERNAL.DEMO_OIDC_AUTHORIZATION_ENDPOINT }}
OIDC_TOKEN_ENDPOINT: ${{ secrets.INTERNAL_OIDC_TOKEN_ENDPOINT }}
OIDC_LOGOUT_ENDPOINT: ${{ secrets.INTERNAL_OIDC_LOGOUT_ENDPOINT }}
OIDC_STORAGE_KEY_PREFIX: ${{ secrets.INTERNAL_OIDC_STORAGE_KEY_PREFIX }}
run: |
touch .env
echo VITE_DATAVERSE_BACKEND_URL="$DATAVERSE_BACKEND_URL" >> .env
echo VITE_OIDC_CLIENT_ID="$OIDC_CLIENT_ID" >> .env
echo VITE_OIDC_AUTHORIZATION_ENDPOINT="$OIDC_AUTHORIZATION_ENDPOINT" >> .env
echo VITE_OIDC_TOKEN_ENDPOINT="$OIDC_TOKEN_ENDPOINT" >> .env
echo VITE_OIDC_LOGOUT_ENDPOINT="$OIDC_LOGOUT_ENDPOINT" >> .env
echo VITE_OIDC_STORAGE_KEY_PREFIX="$OIDC_STORAGE_KEY_PREFIX" >> .env
shell: bash

- name: Build with base path
run: npm run build -- --base=/${{ github.event.inputs.basepath }}

Expand Down Expand Up @@ -171,6 +192,18 @@ jobs:
target: '/tmp'
overwrite: true

# For INTERNAL environment
- name: Copy war file to remote INTERNAL instance
if: ${{ github.event.inputs.environment == 'internal' }}
uses: appleboy/scp-action@master
with:
host: ${{ secrets.INTERNAL_PAYARA_INSTANCE_HOST }}
username: ${{ secrets.INTERNAL_PAYARA_INSTANCE_USERNAME }}
key: ${{ secrets.INTERNAL_PAYARA_INSTANCE_SSH_PRIVATE_KEY }}
source: './deployment/payara/target/dataverse-frontend.war'
target: '/tmp'
overwrite: true

# For BETA environment
- name: Execute payara war deployment remotely on BETA
if: ${{ github.event.inputs.environment == 'beta' }}
Expand Down Expand Up @@ -218,3 +251,19 @@ jobs:
DATAVERSE_FRONTEND=`$ASADMIN list-applications |grep $APPLICATION_NAME |awk '{print $1}'`
$ASADMIN undeploy $DATAVERSE_FRONTEND
$ASADMIN deploy --name $APPLICATION_NAME --contextroot /${{ github.event.inputs.basepath }} $APPLICATION_WAR_PATH

# For INTERNAL environment
- name: Execute payara war deployment remotely on INTERNAL
if: ${{ github.event.inputs.environment == 'internal' }}
uses: appleboy/[email protected]
with:
host: ${{ secrets.INTERNAL_PAYARA_INSTANCE_HOST }}
username: ${{ secrets.INTERNAL_PAYARA_INSTANCE_USERNAME }}
key: ${{ secrets.INTERNAL_PAYARA_INSTANCE_SSH_PRIVATE_KEY }}
script: |
APPLICATION_NAME=dataverse-frontend
APPLICATION_WAR_PATH=/tmp/deployment/payara/target/$APPLICATION_NAME.war
ASADMIN='/usr/local/payara6/bin/asadmin --user admin'
DATAVERSE_FRONTEND=`$ASADMIN list-applications |grep $APPLICATION_NAME |awk '{print $1}'`
$ASADMIN undeploy $DATAVERSE_FRONTEND
$ASADMIN deploy --name $APPLICATION_NAME --contextroot /${{ github.event.inputs.basepath }} $APPLICATION_WAR_PATH
Loading