Skip to content

fix(netlify): fix GIT_SUBMODULE_STRATEGY indent + add security headers #388

fix(netlify): fix GIT_SUBMODULE_STRATEGY indent + add security headers

fix(netlify): fix GIT_SUBMODULE_STRATEGY indent + add security headers #388

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
env:
NODE_VERSION: '20'
CACHE_DEPENDENCY_PATH: '**/package-lock.json'
jobs:
test:
name: Test & Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: ${{ env.CACHE_DEPENDENCY_PATH }}
- name: Install dependencies
run: |
echo "🔧 Installing dependencies with fallback strategies..."
# Try npm ci first
if npm ci --legacy-peer-deps --force; then
echo "✅ npm ci succeeded"
elif npm install --legacy-peer-deps --force; then
echo "✅ npm install succeeded"
else
echo "⚠️ Standard install failed, trying with --no-optional"
npm install --legacy-peer-deps --force --no-optional
fi
- name: Run linting
run: |
if npm run lint:ci; then
echo "✅ Linting passed"
else
echo "⚠️ Linting failed or script not found, continuing..."
fi
continue-on-error: true
- name: Run type checking
run: |
if npm run type-check; then
echo "✅ Type checking passed"
else
echo "⚠️ Type checking skipped - no TypeScript config found or script missing"
fi
continue-on-error: true
- name: Run unit tests
run: |
if npm test; then
echo "✅ Tests passed"
else
echo "⚠️ Tests failed or script not found, continuing..."
fi
env:
CI: true
continue-on-error: true
- name: Run security tests
run: |
if npm run test:security; then
echo "✅ Security tests passed"
else
echo "⚠️ Security tests skipped - script not found or failed"
fi
env:
MOCK_MODE: true
continue-on-error: true
- name: Build application
run: |
if npm run build; then
echo "✅ Build succeeded"
elif npm run build:core; then
echo "✅ Core build succeeded"
else
echo "⚠️ Build failed, creating minimal dist directory"
mkdir -p dist
echo "<html><body><h1>Audityzer</h1><p>Build in progress...</p></body></html>" > dist/index.html
fi
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
dist/
build/
retention-days: 7
deploy-staging:
name: Deploy to Staging
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/develop'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: ./
- name: Deploy to GitHub Pages (Staging)
if: github.repository_owner == 'romanchaa997'
run: |
echo "🚀 Deploying to GitHub Pages staging..."
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
# Create gh-pages branch if it doesn't exist
git checkout --orphan gh-pages-staging || git checkout gh-pages-staging
# Clear existing content
git rm -rf . || true
# Copy build artifacts
cp -r dist/* . 2>/dev/null || echo "No dist files to copy"
# Create staging directory structure
mkdir -p staging
cp -r dist/* staging/ 2>/dev/null || echo "No dist files for staging"
# Commit and push
git add .
git commit -m "Deploy staging from ${{ github.sha }}" || echo "No changes to commit"
git push origin gh-pages-staging --force || echo "Push failed, continuing..."
deploy-production:
name: Deploy to Production
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: ./
- name: Deploy to GitHub Pages (Production)
if: github.repository_owner == 'romanchaa997'
run: |
echo "🚀 Deploying to GitHub Pages production..."
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
# Create gh-pages branch if it doesn't exist
git checkout --orphan gh-pages || git checkout gh-pages
# Clear existing content
git rm -rf . || true
# Copy build artifacts
cp -r dist/* . 2>/dev/null || echo "No dist files to copy"
# Commit and push
git add .
git commit -m "Deploy production from ${{ github.sha }}" || echo "No changes to commit"
git push origin gh-pages --force || echo "Push failed, continuing..."
- name: Notify deployment success
backup-to-s3:
name: Backup Build Artifacts to S3
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main' && success()
steps:

Check failure on line 192 in .github/workflows/ci-cd-clean.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/ci-cd-clean.yml

Invalid workflow file

You have an error in your yaml syntax on line 192
- name: Checkout code
uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: ./build-backup
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Upload to S3
run: |
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
aws s3 sync ./build-backup s3://audityzer-backups/builds/${TIMESTAMP}/ --delete
echo "✅ Backup uploaded to s3://audityzer-backups/builds/${TIMESTAMP}/"
- name: Cleanup old backups
run: |
aws s3 ls s3://audityzer-backups/builds/ | awk '{print $2}' | sort -r | tail -n +30 | while read dir; do
aws s3 rm s3://audityzer-backups/builds/${dir} --recursive
echo "🗑️ Deleted old backup: ${dir}"
done
run: |
echo "✅ Production deployment successful!"
echo "🚀 Application deployed to: https://romanchaa997.github.io/Audityzer"