Skip to content

Commit 01ac453

Browse files
authored
Update deploy.yml
1 parent 5828589 commit 01ac453

1 file changed

Lines changed: 26 additions & 3 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,20 +308,43 @@ jobs:
308308
cat "$HTACCESS_FILE" >> "$LOG_FILE" 2>&1
309309
310310
# Add authz_core_module configuration if not already present
311-
if ! grep -q '<IfModule authz_core_module>' "$HTACCESS_FILE" 2>/dev/null; then
311+
if ! grep -q '<FilesMatch "^(index|upgrade/upgrade)\.php$">' "$HTACCESS_FILE" 2>/dev/null; then
312312
echo "" >> "$HTACCESS_FILE"
313+
echo "# Additional authz_core_module with FilesMatch for index and upgrade scripts" >> "$HTACCESS_FILE"
313314
echo "<IfModule authz_core_module>" >> "$HTACCESS_FILE"
314315
echo " <FilesMatch \"^(index|upgrade/upgrade)\.php$\">" >> "$HTACCESS_FILE"
315316
echo " Require all granted" >> "$HTACCESS_FILE"
316317
echo " </FilesMatch>" >> "$HTACCESS_FILE"
317318
echo "</IfModule>" >> "$HTACCESS_FILE"
318-
echo "$(date): Successfully added authz_core_module configuration to .htaccess" >> "$LOG_FILE"
319+
echo "$(date): Successfully added authz_core_module configuration with FilesMatch to .htaccess" >> "$LOG_FILE"
319320
320321
# Show updated .htaccess content
321322
echo "$(date): Updated .htaccess content:" >> "$LOG_FILE"
322323
cat "$HTACCESS_FILE" >> "$LOG_FILE" 2>&1
323324
else
324-
echo "$(date): authz_core_module configuration already exists in .htaccess" >> "$LOG_FILE"
325+
echo "$(date): authz_core_module configuration with FilesMatch already exists in .htaccess" >> "$LOG_FILE"
326+
fi
327+
328+
# Create .env file in NPM_DIR if it doesn't exist
329+
# First, detect NPM directory
330+
if [ -f "docroot/package.json" ]; then
331+
NPM_DIR="docroot"
332+
else
333+
NPM_DIR="."
334+
fi
335+
336+
ENV_FILE="$NPM_DIR/.env"
337+
if [ ! -f "$ENV_FILE" ]; then
338+
echo "NODE_ENV=production" > "$ENV_FILE"
339+
echo "$(date): Created .env file in $NPM_DIR with NODE_ENV=production" >> "$LOG_FILE"
340+
else
341+
# Check if NODE_ENV is already set
342+
if ! grep -q "NODE_ENV=" "$ENV_FILE" 2>/dev/null; then
343+
echo "NODE_ENV=production" >> "$ENV_FILE"
344+
echo "$(date): Added NODE_ENV=production to existing .env file in $NPM_DIR" >> "$LOG_FILE"
345+
else
346+
echo "$(date): NODE_ENV already exists in .env file in $NPM_DIR" >> "$LOG_FILE"
347+
fi
325348
fi
326349
327350
# Remove the cron job

0 commit comments

Comments
 (0)