Skip to content

Commit 9ccd5e0

Browse files
authored
Added internal to deploy.yml
1 parent cd0b794 commit 9ccd5e0

File tree

1 file changed

+51
-1
lines changed

1 file changed

+51
-1
lines changed

.github/workflows/deploy.yml

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
- beta
1212
- qa
1313
- demo
14+
- internal
1415
basepath:
1516
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.'
1617
type: string
@@ -80,7 +81,7 @@ jobs:
8081
echo VITE_OIDC_LOGOUT_ENDPOINT="$OIDC_LOGOUT_ENDPOINT" >> .env
8182
echo VITE_OIDC_STORAGE_KEY_PREFIX="$OIDC_STORAGE_KEY_PREFIX" >> .env
8283
shell: bash
83-
84+
8485
# For DEMO environment
8586
- name: Create and populate .env file for DEMO
8687
if: ${{ github.event.inputs.environment == 'demo' }}
@@ -101,6 +102,26 @@ jobs:
101102
echo VITE_OIDC_STORAGE_KEY_PREFIX="$OIDC_STORAGE_KEY_PREFIX" >> .env
102103
shell: bash
103104

105+
# For INTERNAL environment
106+
- name: Create and populate .env file for INTERNAL
107+
if: ${{ github.event.inputs.environment == 'internal' }}
108+
env:
109+
DATAVERSE_BACKEND_URL: ${{ secrets.INTERNAL_DATAVERSE_BACKEND_URL }}
110+
OIDC_CLIENT_ID: ${{ secrets.INTERNAL_OIDC_CLIENT_ID }}
111+
OIDC_AUTHORIZATION_ENDPOINT: ${{ INTERNAL.DEMO_OIDC_AUTHORIZATION_ENDPOINT }}
112+
OIDC_TOKEN_ENDPOINT: ${{ secrets.INTERNAL_OIDC_TOKEN_ENDPOINT }}
113+
OIDC_LOGOUT_ENDPOINT: ${{ secrets.INTERNAL_OIDC_LOGOUT_ENDPOINT }}
114+
OIDC_STORAGE_KEY_PREFIX: ${{ secrets.INTERNAL_OIDC_STORAGE_KEY_PREFIX }}
115+
run: |
116+
touch .env
117+
echo VITE_DATAVERSE_BACKEND_URL="$DATAVERSE_BACKEND_URL" >> .env
118+
echo VITE_OIDC_CLIENT_ID="$OIDC_CLIENT_ID" >> .env
119+
echo VITE_OIDC_AUTHORIZATION_ENDPOINT="$OIDC_AUTHORIZATION_ENDPOINT" >> .env
120+
echo VITE_OIDC_TOKEN_ENDPOINT="$OIDC_TOKEN_ENDPOINT" >> .env
121+
echo VITE_OIDC_LOGOUT_ENDPOINT="$OIDC_LOGOUT_ENDPOINT" >> .env
122+
echo VITE_OIDC_STORAGE_KEY_PREFIX="$OIDC_STORAGE_KEY_PREFIX" >> .env
123+
shell: bash
124+
104125
- name: Build with base path
105126
run: npm run build -- --base=/${{ github.event.inputs.basepath }}
106127

@@ -171,6 +192,18 @@ jobs:
171192
target: '/tmp'
172193
overwrite: true
173194

195+
# For INTERNAL environment
196+
- name: Copy war file to remote INTERNAL instance
197+
if: ${{ github.event.inputs.environment == 'internal' }}
198+
uses: appleboy/scp-action@master
199+
with:
200+
host: ${{ secrets.INTERNAL_PAYARA_INSTANCE_HOST }}
201+
username: ${{ secrets.INTERNAL_PAYARA_INSTANCE_USERNAME }}
202+
key: ${{ secrets.INTERNAL_PAYARA_INSTANCE_SSH_PRIVATE_KEY }}
203+
source: './deployment/payara/target/dataverse-frontend.war'
204+
target: '/tmp'
205+
overwrite: true
206+
174207
# For BETA environment
175208
- name: Execute payara war deployment remotely on BETA
176209
if: ${{ github.event.inputs.environment == 'beta' }}
@@ -218,3 +251,20 @@ jobs:
218251
DATAVERSE_FRONTEND=`$ASADMIN list-applications |grep $APPLICATION_NAME |awk '{print $1}'`
219252
$ASADMIN undeploy $DATAVERSE_FRONTEND
220253
$ASADMIN deploy --name $APPLICATION_NAME --contextroot /${{ github.event.inputs.basepath }} $APPLICATION_WAR_PATH
254+
255+
# For INTERNAL environment
256+
- name: Execute payara war deployment remotely on INTERNAL
257+
if: ${{ github.event.inputs.environment == 'internal' }}
258+
uses: appleboy/[email protected]
259+
with:
260+
host: ${{ secrets.INTERNAL_PAYARA_INSTANCE_HOST }}
261+
username: ${{ secrets.INTERNAL_PAYARA_INSTANCE_USERNAME }}
262+
key: ${{ secrets.INTERNAL_PAYARA_INSTANCE_SSH_PRIVATE_KEY }}
263+
script: |
264+
APPLICATION_NAME=dataverse-frontend
265+
APPLICATION_WAR_PATH=/tmp/deployment/payara/target/$APPLICATION_NAME.war
266+
ASADMIN='/usr/local/payara6/bin/asadmin --user admin'
267+
DATAVERSE_FRONTEND=`$ASADMIN list-applications |grep $APPLICATION_NAME |awk '{print $1}'`
268+
$ASADMIN undeploy $DATAVERSE_FRONTEND
269+
$ASADMIN deploy --name $APPLICATION_NAME --contextroot /${{ github.event.inputs.basepath }} $APPLICATION_WAR_PATH
270+

0 commit comments

Comments
 (0)