|
| 1 | +name: Tabiya Compass Frontend Deploy |
| 2 | +on: |
| 3 | + workflow_call: |
| 4 | + inputs: |
| 5 | + target-environment: |
| 6 | + required: true |
| 7 | + type: string |
| 8 | + backendRestApiURLBase: |
| 9 | + required: true |
| 10 | + type: string |
| 11 | + outputs: |
| 12 | + version-info: |
| 13 | + description: 'The frontend version info' |
| 14 | + value: ${{ jobs.build.outputs.version-info }} |
| 15 | + |
| 16 | +jobs: |
| 17 | + deploy: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + environment: ${{ inputs.target-environment }} |
| 20 | + outputs: |
| 21 | + version-info: ${{ steps.setVersionInfo.outputs.version-info }} |
| 22 | + steps: |
| 23 | + - name: Checkout code |
| 24 | + uses: actions/checkout@v4 |
| 25 | + - name: Set Version Info |
| 26 | + id: setVersionInfo |
| 27 | + run: | |
| 28 | + ./pipeline/setVersionInfo.sh frontend/public/data/version.json |
| 29 | + cat frontend/public/data/version.json |
| 30 | + EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) |
| 31 | + echo "version-info<<$EOF" >> "$GITHUB_OUTPUT" |
| 32 | + echo "$(cat ./frontend/public/data/version.json)" >> "$GITHUB_OUTPUT" |
| 33 | + echo "$EOF" >> "$GITHUB_OUTPUT" |
| 34 | + - name: Use Node.js 20.x |
| 35 | + uses: actions/setup-node@v4 |
| 36 | + with: |
| 37 | + node-version: 20.x |
| 38 | + cache: 'yarn' |
| 39 | + cache-dependency-path: frontend/yarn.lock |
| 40 | + - name: Install node packages |
| 41 | + run: yarn install |
| 42 | + working-directory: frontend |
| 43 | + - name: build |
| 44 | + run: yarn run build |
| 45 | + working-directory: frontend |
| 46 | + env: |
| 47 | + NEXT_PUBLIC_COMPASS_URL: ${{ inputs.backendRestApiURLBase }} |
| 48 | + NEXT_PUBLIC_COMPASS_ENDPOINT: '/conversation' |
| 49 | + - name: Setup python |
| 50 | + uses: actions/setup-python@v5 |
| 51 | + with: |
| 52 | + python-version: '3.11' |
| 53 | + cache: 'pip' # caching pip dependencies |
| 54 | + - name: Install python packages |
| 55 | + run: pip install -r requirements.txt |
| 56 | + working-directory: iac/frontend |
| 57 | + - name: Setup google-cloud-auth |
| 58 | + uses: google-github-actions/[email protected] |
| 59 | + with: |
| 60 | + credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_JSON }} |
| 61 | + - name: Deploy frontend |
| 62 | + id: pulumi |
| 63 | + uses: pulumi/actions@v5 |
| 64 | + with: |
| 65 | + work-dir: iac/frontend |
| 66 | + command: up |
| 67 | + stack-name: tabiya-tech/compass-frontend/${{ inputs.target-environment }} |
| 68 | + env: |
| 69 | + PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }} |
| 70 | + MONGODB_URI: ${{ secrets.MONGODB_URI }} |
| 71 | + NEXT_PUBLIC_COMPASS_URL: ${{ inputs.backendRestApiURLBase }} |
| 72 | + - name: Show frontend URL |
| 73 | + run: echo "frontend-url<<${{ steps.pulumi.outputs.bucket_url }}" |
0 commit comments