Delete .github/workflows/ErrorsLog.yml #12
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: Build and Deploy Angular App | |
| on: | |
| push: | |
| branches: | |
| - Production | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '16' | |
| cache: 'yarn' | |
| - name: Install Yarn | |
| run: npm install -g yarn | |
| - name: Install dependencies with Yarn | |
| run: yarn install | |
| - name: Generate build timestamp | |
| id: timestamp | |
| run: echo "timestamp=$(date +'%Y%m%d_%H%M%S')" >> $GITHUB_OUTPUT | |
| - name: Create logs directory | |
| run: mkdir -p deployment_logs | |
| - name: Check Angular output path in angular.json | |
| id: check_config | |
| run: | | |
| if [ -f "angular.json" ]; then | |
| DEFAULT_OUTPUT_PATH=$(grep -o '"outputPath": *"[^"]*"' angular.json | head -1 | cut -d'"' -f4) | |
| if [ -n "$DEFAULT_OUTPUT_PATH" ]; then | |
| echo "output_path=$DEFAULT_OUTPUT_PATH" >> $GITHUB_OUTPUT | |
| echo "Using output path from angular.json: $DEFAULT_OUTPUT_PATH" | |
| else | |
| echo "output_path=dist" >> $GITHUB_OUTPUT | |
| echo "No outputPath found in angular.json, using default: dist" | |
| fi | |
| else | |
| echo "output_path=dist" >> $GITHUB_OUTPUT | |
| echo "No angular.json found, using default: dist" | |
| fi | |
| - name: Build Angular app | |
| run: | | |
| yarn build --configuration production --base-href="/${{ github.event.repository.name }}/" 2>&1 | tee deployment_logs/build_log_${{ steps.timestamp.outputs.timestamp }}.txt | |
| - name: Ensure docs directory exists | |
| run: | | |
| if [ ! -d "docs" ]; then | |
| if [ -d "${{ steps.check_config.outputs.output_path }}" ]; then | |
| echo "Build directory found at ${{ steps.check_config.outputs.output_path }}, copying to docs/" | |
| mkdir -p docs | |
| cp -r ${{ steps.check_config.outputs.output_path }}/* docs/ | |
| else | |
| echo "Build directory not found at ${{ steps.check_config.outputs.output_path }}, listing contents of current directory:" | |
| ls -la | |
| echo "Creating empty docs directory" | |
| mkdir -p docs | |
| fi | |
| fi | |
| - name: Add .nojekyll file | |
| run: touch docs/.nojekyll | |
| - name: Deploy to GitHub Pages | |
| id: deploy | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| folder: docs | |
| branch: gh-pages | |
| clean: true | |
| - name: Log deployment result | |
| run: | | |
| echo "Deployment completed at $(date)" >> deployment_logs/deploy_summary_${{ steps.timestamp.outputs.timestamp }}.txt | |
| echo "Commit: ${{ github.sha }}" >> deployment_logs/deploy_summary_${{ steps.timestamp.outputs.timestamp }}.txt | |
| echo "Deployment status: ${{ steps.deploy.outcome }}" >> deployment_logs/deploy_summary_${{ steps.timestamp.outputs.timestamp }}.txt | |
| - name: Archive deployment logs | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: deployment-logs-${{ steps.timestamp.outputs.timestamp }} | |
| path: deployment_logs/ | |
| retention-days: 30 |