|
34 | 34 | - name: Create logs directory |
35 | 35 | run: mkdir -p deployment_logs |
36 | 36 |
|
| 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 | + |
37 | 54 | - name: Build Angular app |
38 | 55 | 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 |
40 | 72 | |
41 | 73 | - name: Add .nojekyll file |
42 | 74 | run: touch docs/.nojekyll |
|
0 commit comments