fix: resolve deployment issues with nx command and force build flag #49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Nx Optimized CI | |
| # Optimized CI pipeline for Nx workspace | |
| on: | |
| push: | |
| branches: [main, dev] | |
| pull_request: | |
| branches: [main, dev] | |
| workflow_dispatch: | |
| env: | |
| NX_BRANCH: ${{ github.event.number || github.ref_name }} | |
| NX_RUN_GROUP: ${{ github.run_id }} | |
| HUSKY: 0 | |
| # Set DOCS_ENV based on branch/event type for proper environment detection | |
| DOCS_ENV: ${{ github.event_name == 'pull_request' && 'preview' || github.ref_name == 'main' && 'production' || github.ref_name == 'dev' && 'development' || 'development' }} | |
| # Fallback environment variables for sites that need them | |
| SITE_TITLE: IFLA Standards Portal | |
| SITE_TAGLINE: International Federation of Library Associations and Institutions | |
| jobs: | |
| ci: | |
| name: CI Pipeline | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout [Pull Request] | |
| uses: actions/checkout@v4 | |
| if: ${{ github.event_name == 'pull_request' }} | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Checkout [Default Branch] | |
| uses: actions/checkout@v4 | |
| if: ${{ github.event_name != 'pull_request' }} | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Derive appropriate SHAs for base and head for `nx affected` commands | |
| uses: nrwl/nx-set-shas@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --no-frozen-lockfile | |
| - name: Build affected projects for deployment validation | |
| run: npx nx affected --target=build --parallel=3 | |