Apps/nutritionfacts/additionalTests (#146) #61
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: Deploy Apps | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: 'pages' | |
| cancel-in-progress: true | |
| jobs: | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check for changes in ./apps | |
| id: changes | |
| shell: bash | |
| run: | | |
| BEFORE_SHA="${{ github.event.before }}" | |
| AFTER_SHA="${{ github.sha }}" | |
| if git cat-file -e "$BEFORE_SHA" 2>/dev/null; then | |
| DIFF_RANGE="$BEFORE_SHA $AFTER_SHA" | |
| else | |
| DIFF_RANGE="HEAD~1 HEAD" | |
| fi | |
| if ! git diff --name-only $DIFF_RANGE | grep '^apps/' ; then | |
| echo "No changes in ./apps directory. Exiting early." | |
| echo "skip_steps=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "skip_steps=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Set up Node | |
| if: steps.changes.outputs.skip_steps != 'true' | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| - name: Setup pnpm | |
| if: steps.changes.outputs.skip_steps != 'true' | |
| uses: pnpm/action-setup@v4.1.0 | |
| # ✅ NEW: configure pnpm to use registry packages, not workspace links | |
| - name: Configure pnpm for registry install | |
| if: steps.changes.outputs.skip_steps != 'true' | |
| run: | | |
| echo "link-workspace-packages=false" >> .npmrc | |
| echo "prefer-workspace-packages=false" >> .npmrc | |
| echo "auto-install-peers=true" >> .npmrc | |
| - name: Install dependencies | |
| if: steps.changes.outputs.skip_steps != 'true' | |
| run: pnpm install --config.prefer-workspace-packages=false --link-workspace-packages=false | |
| - name: Build | |
| if: steps.changes.outputs.skip_steps != 'true' | |
| run: pnpm build apps | |
| - name: Setup Pages | |
| if: steps.changes.outputs.skip_steps != 'true' | |
| uses: actions/configure-pages@v5 | |
| - name: Upload artifact | |
| if: steps.changes.outputs.skip_steps != 'true' | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: './dist' | |
| - name: Deploy to GitHub Pages | |
| if: steps.changes.outputs.skip_steps != 'true' | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |