Skip to content

Fix build: use pnpm --filter to run build from workspace root #3

Fix build: use pnpm --filter to run build from workspace root

Fix build: use pnpm --filter to run build from workspace root #3

Workflow file for this run

name: Deploy Product Docs
on:
push:
branches: [astro]
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# Clone parent landing-page repo which has the pnpm workspace
# and @futureagi/chat-widget that product-docs depends on.
- name: Clone landing-page workspace
run: |
git clone --depth 1 \
https://x-access-token:${{ secrets.GH_PAT }}@github.com/future-agi/landing-page.git .
# Replace the submodule with the actual commit that triggered this build
- name: Checkout product-docs at trigger commit
run: |
rm -rf product-docs
git clone --depth 1 --branch ${{ github.ref_name }} \
https://x-access-token:${{ secrets.GH_PAT }}@github.com/future-agi/docs.git product-docs
cd product-docs
git checkout ${{ github.sha }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Get pnpm store directory
shell: bash
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Cache pnpm dependencies
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-pnpm-
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
- name: Create .env.production for build
working-directory: product-docs
run: |
cat <<EOF > .env.production
PUBLIC_DOCS_AGENT_URL=${{ secrets.PUBLIC_DOCS_AGENT_URL }}
PUBLIC_TURNSTILE_SITE_KEY=${{ secrets.PUBLIC_TURNSTILE_SITE_KEY }}
EOF
- name: Build product docs
run: pnpm --filter bustling-binary build
env:
NODE_OPTIONS: --max-old-space-size=4096
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Sync dist/ to S3
run: |
aws s3 sync product-docs/dist/ s3://${{ secrets.DOCS_S3_BUCKET }}/ --delete
- name: Invalidate CloudFront cache
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.DOCS_CLOUDFRONT_DISTRIBUTION_ID }} \
--paths "/*"