Skip to content

Commit 8decbf8

Browse files
Update deploy.yml
1 parent f64c94f commit 8decbf8

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

.github/workflows/deploy.yml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,41 @@ jobs:
3434
- name: Create logs directory
3535
run: mkdir -p deployment_logs
3636

37+
- name: Check Angular output path in angular.json
38+
id: check_config
39+
run: |
40+
if [ -f "angular.json" ]; then
41+
DEFAULT_OUTPUT_PATH=$(grep -o '"outputPath": *"[^"]*"' angular.json | head -1 | cut -d'"' -f4)
42+
if [ -n "$DEFAULT_OUTPUT_PATH" ]; then
43+
echo "output_path=$DEFAULT_OUTPUT_PATH" >> $GITHUB_OUTPUT
44+
echo "Using output path from angular.json: $DEFAULT_OUTPUT_PATH"
45+
else
46+
echo "output_path=dist" >> $GITHUB_OUTPUT
47+
echo "No outputPath found in angular.json, using default: dist"
48+
fi
49+
else
50+
echo "output_path=dist" >> $GITHUB_OUTPUT
51+
echo "No angular.json found, using default: dist"
52+
fi
53+
3754
- name: Build Angular app
3855
run: |
39-
yarn build --configuration production --output-path=docs --base-href="/${{ github.event.repository.name }}/" 2>&1 | tee deployment_logs/build_log_${{ steps.timestamp.outputs.timestamp }}.txt
56+
yarn build --configuration production --base-href="/${{ github.event.repository.name }}/" 2>&1 | tee deployment_logs/build_log_${{ steps.timestamp.outputs.timestamp }}.txt
57+
58+
- name: Ensure docs directory exists
59+
run: |
60+
if [ ! -d "docs" ]; then
61+
if [ -d "${{ steps.check_config.outputs.output_path }}" ]; then
62+
echo "Build directory found at ${{ steps.check_config.outputs.output_path }}, copying to docs/"
63+
mkdir -p docs
64+
cp -r ${{ steps.check_config.outputs.output_path }}/* docs/
65+
else
66+
echo "Build directory not found at ${{ steps.check_config.outputs.output_path }}, listing contents of current directory:"
67+
ls -la
68+
echo "Creating empty docs directory"
69+
mkdir -p docs
70+
fi
71+
fi
4072
4173
- name: Add .nojekyll file
4274
run: touch docs/.nojekyll

0 commit comments

Comments
 (0)