Skip to content

Commit 0178c30

Browse files
committed
fix: resolve deployment issues with nx command and force build flag
- Use 'pnpm nx' instead of 'nx' to ensure command availability - Fix force build flag handling for empty string inputs - Add better error handling and debugging output
1 parent e724bc0 commit 0178c30

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

.github/workflows/deploy-dev.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@ jobs:
7272
- name: Detect affected projects
7373
id: affected
7474
run: |
75-
if [ "${{ inputs.force_build_all }}" = "true" ]; then
75+
# Check for force build flag (handle empty string as false)
76+
FORCE_BUILD="${{ inputs.force_build_all }}"
77+
if [ "$FORCE_BUILD" = "true" ]; then
7678
echo "Force building all projects..."
77-
projects=$(nx show projects --type=app | tr '\n' ' ')
79+
projects=$(pnpm nx show projects --type=app | tr '\n' ' ')
7880
echo "projects=$projects" >> $GITHUB_OUTPUT
7981
echo "has-affected=true" >> $GITHUB_OUTPUT
8082
else
@@ -84,24 +86,24 @@ jobs:
8486
8587
# Show what would be affected (including libraries for debugging)
8688
echo "All affected projects:"
87-
nx show projects --affected || echo "Failed to get affected projects"
89+
pnpm nx show projects --affected || echo "Failed to get affected projects"
8890
8991
# Get affected apps for deployment
90-
affected=$(nx show projects --affected --type=app 2>/dev/null | tr '\n' ' ' || echo "")
92+
affected=$(pnpm nx show projects --affected --type=app 2>/dev/null | tr '\n' ' ' || echo "")
9193
if [ -z "$affected" ]; then
9294
echo "No affected app projects found"
9395
echo "Trying with explicit base SHA..."
9496
if [ -n "$NX_BASE" ]; then
95-
affected=$(nx show projects --affected --type=app --base=$NX_BASE 2>/dev/null | tr '\n' ' ' || echo "")
97+
affected=$(pnpm nx show projects --affected --type=app --base=$NX_BASE 2>/dev/null | tr '\n' ' ' || echo "")
9698
fi
9799
98100
# Special handling for theme changes - if theme is affected, all apps should rebuild
99101
if [ -z "$affected" ]; then
100102
echo "Checking if theme package is affected..."
101-
theme_affected=$(nx show projects --affected | grep "@ifla/theme" || echo "")
103+
theme_affected=$(pnpm nx show projects --affected | grep "@ifla/theme" || echo "")
102104
if [ -n "$theme_affected" ]; then
103105
echo "Theme package is affected - rebuilding all sites"
104-
affected=$(nx show projects --type=app | tr '\n' ' ')
106+
affected=$(pnpm nx show projects --type=app | tr '\n' ' ')
105107
echo "All projects due to theme change: $affected"
106108
echo "projects=$affected" >> $GITHUB_OUTPUT
107109
echo "has-affected=true" >> $GITHUB_OUTPUT
@@ -124,10 +126,13 @@ jobs:
124126
- name: Build affected projects
125127
if: steps.affected.outputs.has-affected == 'true'
126128
run: |
127-
if [ "${{ inputs.force_build_all }}" = "true" ]; then
128-
nx run-many --target=build --all --parallel=1 --configuration=development
129+
FORCE_BUILD="${{ inputs.force_build_all }}"
130+
if [ "$FORCE_BUILD" = "true" ]; then
131+
echo "Force building all projects"
132+
pnpm nx run-many --target=build --all --parallel=1 --configuration=development
129133
else
130-
nx affected --target=build --parallel=1 --configuration=development
134+
echo "Building affected projects"
135+
pnpm nx affected --target=build --parallel=1 --configuration=development
131136
fi
132137
env:
133138
DOCS_ENV: development

0 commit comments

Comments
 (0)