|
| 1 | +name: deploy |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + environment: |
| 7 | + description: Target environment |
| 8 | + type: choice |
| 9 | + required: true |
| 10 | + options: |
| 11 | + - beta |
| 12 | + - qa |
| 13 | + - demo |
| 14 | + basepath: |
| 15 | + 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.' |
| 16 | + type: string |
| 17 | + required: false |
| 18 | + |
| 19 | +jobs: |
| 20 | + build: |
| 21 | + runs-on: ubuntu-latest |
| 22 | + |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v3 |
| 25 | + |
| 26 | + - uses: actions/setup-node@v3 |
| 27 | + with: |
| 28 | + node-version: 22 |
| 29 | + cache: 'npm' |
| 30 | + |
| 31 | + - name: Create .npmrc |
| 32 | + run: | |
| 33 | + cp .npmrc.example .npmrc |
| 34 | + sed -i -e 's/<YOUR_GITHUB_AUTH_TOKEN>/${{ secrets.GITHUB_TOKEN }}/g' .npmrc |
| 35 | + sed -i -e 's/<YOUR_NPM_AUTH_TOKEN>/${{ secrets.NPM_AUTH_TOKEN }}/g' .npmrc |
| 36 | +
|
| 37 | + - name: Install Dependencies |
| 38 | + run: npm install |
| 39 | + |
| 40 | + - name: Build Dataverse UI Library |
| 41 | + working-directory: packages/design-system |
| 42 | + run: npm run build |
| 43 | + |
| 44 | + - name: Build with base path |
| 45 | + run: npm run build -- --base=/${{ github.event.inputs.basepath }} |
| 46 | + |
| 47 | + - name: Override runtime config.js for BETA |
| 48 | + if: ${{ github.event.inputs.environment == 'beta' }} |
| 49 | + env: |
| 50 | + DATAVERSE_BACKEND_URL: ${{ secrets.BETA_DATAVERSE_BACKEND_URL }} |
| 51 | + OIDC_CLIENT_ID: ${{ secrets.BETA_OIDC_CLIENT_ID }} |
| 52 | + OIDC_AUTHORIZATION_ENDPOINT: ${{ secrets.BETA_OIDC_AUTHORIZATION_ENDPOINT }} |
| 53 | + OIDC_TOKEN_ENDPOINT: ${{ secrets.BETA_OIDC_TOKEN_ENDPOINT }} |
| 54 | + OIDC_LOGOUT_ENDPOINT: ${{ secrets.BETA_OIDC_LOGOUT_ENDPOINT }} |
| 55 | + OIDC_STORAGE_KEY_PREFIX: ${{ secrets.BETA_OIDC_STORAGE_KEY_PREFIX }} |
| 56 | + run: | |
| 57 | + mkdir -p ./dist |
| 58 | + cat > ./dist/config.js <<EOF |
| 59 | + window.__APP_CONFIG__ = { |
| 60 | + backendUrl: "${DATAVERSE_BACKEND_URL}", |
| 61 | + oidc: { |
| 62 | + clientId: "${OIDC_CLIENT_ID}", |
| 63 | + authorizationEndpoint: "${OIDC_AUTHORIZATION_ENDPOINT}", |
| 64 | + tokenEndpoint: "${OIDC_TOKEN_ENDPOINT}", |
| 65 | + logoutEndpoint: "${OIDC_LOGOUT_ENDPOINT}", |
| 66 | + localStorageKeyPrefix: "${OIDC_STORAGE_KEY_PREFIX}" |
| 67 | + }, |
| 68 | + languages: [ |
| 69 | + { code: 'en', name: 'English' }, |
| 70 | + { code: 'es', name: 'Español' }, |
| 71 | + ], |
| 72 | + defaultLanguage: 'en' |
| 73 | + } |
| 74 | + EOF |
| 75 | +
|
| 76 | + - name: Override runtime config.js for QA |
| 77 | + if: ${{ github.event.inputs.environment == 'qa' }} |
| 78 | + env: |
| 79 | + DATAVERSE_BACKEND_URL: ${{ secrets.QA_DATAVERSE_BACKEND_URL }} |
| 80 | + OIDC_CLIENT_ID: ${{ secrets.QA_OIDC_CLIENT_ID }} |
| 81 | + OIDC_AUTHORIZATION_ENDPOINT: ${{ secrets.QA_OIDC_AUTHORIZATION_ENDPOINT }} |
| 82 | + OIDC_TOKEN_ENDPOINT: ${{ secrets.QA_OIDC_TOKEN_ENDPOINT }} |
| 83 | + OIDC_LOGOUT_ENDPOINT: ${{ secrets.QA_OIDC_LOGOUT_ENDPOINT }} |
| 84 | + OIDC_STORAGE_KEY_PREFIX: ${{ secrets.QA_OIDC_STORAGE_KEY_PREFIX }} |
| 85 | + run: | |
| 86 | + mkdir -p ./dist |
| 87 | + cat > ./dist/config.js <<EOF |
| 88 | + window.__APP_CONFIG__ = { |
| 89 | + backendUrl: "${DATAVERSE_BACKEND_URL}", |
| 90 | + oidc: { |
| 91 | + clientId: "${OIDC_CLIENT_ID}", |
| 92 | + authorizationEndpoint: "${OIDC_AUTHORIZATION_ENDPOINT}", |
| 93 | + tokenEndpoint: "${OIDC_TOKEN_ENDPOINT}", |
| 94 | + logoutEndpoint: "${OIDC_LOGOUT_ENDPOINT}", |
| 95 | + localStorageKeyPrefix: "${OIDC_STORAGE_KEY_PREFIX}" |
| 96 | + }, |
| 97 | + languages: [ |
| 98 | + { code: 'en', name: 'English' }, |
| 99 | + { code: 'es', name: 'Español' }, |
| 100 | + ], |
| 101 | + defaultLanguage: 'en' |
| 102 | + } |
| 103 | + EOF |
| 104 | +
|
| 105 | + - name: Override runtime config.js for DEMO |
| 106 | + if: ${{ github.event.inputs.environment == 'demo' }} |
| 107 | + env: |
| 108 | + DATAVERSE_BACKEND_URL: ${{ secrets.DEMO_DATAVERSE_BACKEND_URL }} |
| 109 | + OIDC_CLIENT_ID: ${{ secrets.DEMO_OIDC_CLIENT_ID }} |
| 110 | + OIDC_AUTHORIZATION_ENDPOINT: ${{ secrets.DEMO_OIDC_AUTHORIZATION_ENDPOINT }} |
| 111 | + OIDC_TOKEN_ENDPOINT: ${{ secrets.DEMO_OIDC_TOKEN_ENDPOINT }} |
| 112 | + OIDC_LOGOUT_ENDPOINT: ${{ secrets.DEMO_OIDC_LOGOUT_ENDPOINT }} |
| 113 | + OIDC_STORAGE_KEY_PREFIX: ${{ secrets.DEMO_OIDC_STORAGE_KEY_PREFIX }} |
| 114 | + run: | |
| 115 | + mkdir -p ./dist |
| 116 | + cat > ./dist/config.js <<EOF |
| 117 | + window.__APP_CONFIG__ = { |
| 118 | + backendUrl: "${DATAVERSE_BACKEND_URL}", |
| 119 | + oidc: { |
| 120 | + clientId: "${OIDC_CLIENT_ID}", |
| 121 | + authorizationEndpoint: "${OIDC_AUTHORIZATION_ENDPOINT}", |
| 122 | + tokenEndpoint: "${OIDC_TOKEN_ENDPOINT}", |
| 123 | + logoutEndpoint: "${OIDC_LOGOUT_ENDPOINT}", |
| 124 | + localStorageKeyPrefix: "${OIDC_STORAGE_KEY_PREFIX}" |
| 125 | + }, |
| 126 | + languages: [ |
| 127 | + { code: 'en', name: 'English' }, |
| 128 | + { code: 'es', name: 'Español' }, |
| 129 | + ], |
| 130 | + defaultLanguage: 'en' |
| 131 | + } |
| 132 | + EOF |
| 133 | +
|
| 134 | + - uses: actions/upload-artifact@v4 |
| 135 | + with: |
| 136 | + name: built-site |
| 137 | + path: ./dist |
| 138 | + include-hidden-files: true |
| 139 | + |
| 140 | + generate-war: |
| 141 | + needs: build |
| 142 | + runs-on: ubuntu-latest |
| 143 | + |
| 144 | + steps: |
| 145 | + - uses: actions/checkout@v3 |
| 146 | + |
| 147 | + - uses: actions/setup-java@v3 |
| 148 | + with: |
| 149 | + distribution: 'zulu' |
| 150 | + java-version: '11' |
| 151 | + |
| 152 | + - uses: actions/download-artifact@v4 |
| 153 | + with: |
| 154 | + name: built-site |
| 155 | + path: ./dist |
| 156 | + |
| 157 | + - name: Get branch name |
| 158 | + id: branch-name |
| 159 | + uses: tj-actions/branch-names@v6 |
| 160 | + |
| 161 | + - name: Build war file |
| 162 | + working-directory: ./deployment/payara |
| 163 | + run: mvn package "-Dversion=${{ steps.branch-name.outputs.current_branch }}" |
| 164 | + |
| 165 | + - uses: actions/upload-artifact@v4 |
| 166 | + with: |
| 167 | + name: war-file |
| 168 | + path: ./deployment/payara/target/*.war |
| 169 | + |
0 commit comments