diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml new file mode 100644 index 0000000..b4b6b72 --- /dev/null +++ b/.github/workflows/ci-cd.yml @@ -0,0 +1,70 @@ +name: CI/CD Pipeline + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + pages: write + id-token: write + +jobs: + ci: + name: Continuous Integration + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: "npm" + + - name: Install dependencies + run: npm ci + + - name: Run linter + run: npm run lint + + - name: Check formatting + run: npm run format:check + + - name: Run tests + run: npm test + + - name: Build project + run: npm run build + + - name: Generate build log + run: | + mkdir -p build-logs + echo "Build timestamp: $(date)" > build-logs/build-log.txt + + - name: Upload build logs + uses: actions/upload-artifact@v4 + with: + name: build-logs + path: build-logs/ + + - name: Upload demo site + uses: actions/upload-artifact@v4 + with: + name: demo-site + path: demo/ + + cd: + name: Continuous Deployment + needs: ci + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + + steps: + - name: Deploy to GitHub Pages + uses: actions/deploy-pages@v4 +