All Guides
GitHub Actions CI/CD Einrichtung
Erstellen Sie eine automatisierte Test-, Build- und Deploy-Pipeline.
Intermediate25 Min.
Setup Steps
1. Create .github/workflows/ directory in your repository
2. Create a workflow file (.github/workflows/ci.yml):
name: CI/CD Pipeline
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm test
- run: npm run build3. Add a deploy job:
deploy:
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Deploy to server
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SSH_KEY }}
script: |
cd /var/www/app
git pull
npm ci
npm run build
pm2 restart app4. Add required secrets in GitHub Settings > Secrets
5. Trigger the workflow by pushing
6. Monitor results in the Actions tab
Related Guides
Git und GitHub Einrichtung
Installieren Sie Git und verwalten Sie Projekte mit GitHub.
VS Code Einrichtung und Erweiterungen
Installieren Sie VS Code und erweitern Sie es mit Entwickler-Erweiterungen.
Node.js App-Verwaltung mit PM2
Verwalten Sie Ihre Node.js-Apps in der Produktion mit PM2.
Cloudflare DNS und CDN Einrichtung
Fuegen Sie Cloudflare zu Ihrer Website hinzu. DNS, CDN, DDoS-Schutz.