diff --git a/.github/workflows/publish-docs.yaml b/.github/workflows/publish-docs.yaml index 7bd7b2501..e9578e05e 100644 --- a/.github/workflows/publish-docs.yaml +++ b/.github/workflows/publish-docs.yaml @@ -22,48 +22,46 @@ jobs: # Build job build: runs-on: ubuntu-latest + defaults: + run: + working-directory: docs steps: - - name: Checkout - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: node-version: 18 - cache: yarn - cache-dependency-path: 'docs/yarn.lock' + cache: npm + cache-dependency-path: "docs/package-lock.json" - name: Install dependencies - working-directory: docs - run: yarn install --frozen-lockfile + run: npm ci - name: Test build - working-directory: docs run: | - yarn build + npm run build # Basic tests to ensure critical files exist test -f build/index.html || exit 1 test -d build/docs || exit 1 test -d build/assets || exit 1 - - name: Upload build artifact + - name: Upload pages artifact uses: actions/upload-artifact@v4 with: name: github-pages - path: docs/build - retention-days: 1 + path: build # Deploy job deploy: - needs: build - runs-on: ubuntu-latest environment: name: ${{ github.ref == 'refs/heads/main' && 'github-pages' || 'preview' }} url: ${{ steps.deployment.outputs.page_url }} - + runs-on: ubuntu-latest + needs: build steps: - name: Download build uses: actions/download-artifact@v4 with: - name: docusaurus-build + name: github-pages path: build - name: Setup Pages diff --git a/cursor-composers-session-fixdocs.md b/cursor-composers-session-fixdocs.md new file mode 100644 index 000000000..ba3b6e1fe --- /dev/null +++ b/cursor-composers-session-fixdocs.md @@ -0,0 +1,108 @@ +# Documentation Workflow Enhancement Session + +## Context +Working directory: `/Volumes/My Shared Files/go/src/github.com/tmc/langchaingo/examples` +Target: Enhance GitHub Pages documentation deployment workflow + +## Initial State +- GitHub Actions workflow only deploys from main branch +- Package management conflicts between yarn and npm +- Peer dependency warnings in documentation build + +## Changes Attempted + +### 1. Package Management Cleanup +- Identified duplicate package managers (both package-lock.json and yarn.lock present) +- Attempted to remove package-lock.json to standardize on yarn +- Added missing peer dependencies: + ```json + { + "dependencies": { + "react-loadable": "*", + "@algolia/client-search": "^4.22.1", + "search-insights": "^2.13.0" + }, + "devDependencies": { + "typescript": "^5.3.3" + } + } + ``` + +### 2. Workflow Enhancement +Attempted to modify `.github/workflows/publish-docs.yaml` to: +- Enable deployments on docs-test branch +- Add preview environment +- Maintain production deployments on main branch + +Key changes: +```yaml +deploy: + needs: build + if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/docs-test' + environment: + name: ${{ github.ref == 'refs/heads/main' && 'github-pages' || 'preview' }} + url: ${{ steps.deployment.outputs.page_url }} +``` + +## Issues Encountered +1. Directory Location + - Session started in examples subdirectory + - Limited access to main repository files + - Required relative path navigation (../) for file access + +2. Git State Management + - Untracked files in examples/.github + - Challenges with clean git state for commits + - Path resolution issues for workflow file + +## Workflow Testing +Latest workflow run on docs-test branch: +- Run ID: 13174827702 +- Status: Success +- Timestamp: 2025-02-06T08:34:37Z + +## Next Steps +1. Reopen Cursor in correct directory: + `/Volumes/My Shared Files/go/src/github.com/tmc/langchaingo` + +2. Required Changes: + - Update workflow for preview deployments + - Clean up package management + - Resolve peer dependencies + +3. Testing Plan: + - Verify build on docs-test branch + - Confirm preview environment creation + - Test deployment process + +## Command History +Key commands used: +```bash +# Check git status +git status + +# Clean untracked files +rm -rf examples/.github examples/docs + +# Check workflow file +git show HEAD:.github/workflows/publish-docs.yaml + +# Reset to clean state +git fetch origin && git reset --hard origin/docs-test +``` + +## File Changes Required +1. .github/workflows/publish-docs.yaml + - Add docs-test branch to deployment targets + - Configure preview environment + - Maintain production deployment settings + +2. docs/package.json + - Add missing peer dependencies + - Remove package-lock.json + - Standardize on yarn + +## Notes +- Session preserved in this document for continuation in new workspace +- Unix-style commit messages preferred (following Russ Cox's style) +- GitHub Pages deployment requires proper environment configuration \ No newline at end of file