name: Test and Deploy Website on: push: branches: - '**' jobs: test-and-deploy: runs-on: ubuntu-latest steps: - name: Checkout Code uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 20 - name: Install Dependencies run: npm ci - name: Run Unit Tests run: npm run test:unit - name: Run Integration Tests run: npm run test:integration - name: Install Playwright Browsers and Deps run: npx playwright install --with-deps chromium - name: Run E2E Tests run: npm run test:e2e - name: Deploy to Production if: github.ref == 'refs/heads/main' run: | echo "Deploying to Production website..." # Make sure target directory exists (it is mounted from host) mkdir -p /root/docker/website-prod/html # Clean old files rm -rf /root/docker/website-prod/html/* # Copy new files cp -r public/* /root/docker/website-prod/html/ echo "Production deployment completed!" - name: Deploy to Staging if: github.ref != 'refs/heads/main' run: | echo "Deploying to Staging website..." # Make sure target directory exists (it is mounted from host) mkdir -p /root/docker/website-stage/html # Clean old files rm -rf /root/docker/website-stage/html/* # Copy new files cp -r public/* /root/docker/website-stage/html/ echo "Staging deployment completed!"