Setup CI/CD Pipeline dengan GitHub Actions dan Helipod
Manual deployment itu melelahkan. Push ke main, buka dashboard, klik deploy, tunggu selesai. Berulang-ulang.
Dengan GitHub Actions, kamu bisa otomatisasi seluruh proses: push code, GitHub Actions build, test, dan deploy ke Helipod, tanpa klik apapun.
Kenapa CI/CD Penting?#
| Manual Deployment | CI/CD |
|---|---|
| Klik deploy manual | Otomatis setelah push |
| Lupa test sebelum deploy | Test otomatis sebelum deploy |
| Error di production | Error diangkat lebih awal |
| Deploy semua sekaligus | Deploy per commit |
| Tidak ada audit trail | Setiap deploy tercatat |
Cara Kerja#
Developer push ke GitHub
↓
GitHub Actions trigger workflow
↓
GitHub Actions build & test
↓
GitHub Actions deploy ke Helipod
↓
Aplikasi live
Setup Step-by-Step#
Step 1: Buat Workflow File#
Buat file .github/workflows/deploy.yml di repo kamu:
name: Deploy to Helipod
on:
push:
branches: [main]
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Deploy to Helipod
run: |
echo "Deploying to Helipod..."
# Helipod akan auto-deploy dari GitHub webhook
# Trigger deploy via Helipod API
curl -X POST "https://api.helipod.io/v1/deploy" \
-H "Authorization: Bearer ${{ secrets.HELIPOD_API_KEY }}" \
-H "Content-Type: application/json" \
-d '{"project": "${{ secrets.HELIPOD_PROJECT }}"}'
Step 2: Generate API Key#
- Buka Helipod Dashboard → Settings → API Keys
- Klik Generate New Key
- Copy API key
Step 3: Tambah Secrets ke GitHub#
- Buka repo di GitHub → Settings → Secrets and variables → Actions
- Klik New repository secret
- Tambahkan:
HELIPOD_API_KEY: API key dari HelipodHELIPOD_PROJECT: nama project kamu
Step 4: Push Code#
git add .github/workflows/deploy.yml
git commit -m "ci: add deploy workflow"
git push origin main
GitHub Actions akan trigger otomatis.
Workflow yang Lebih Lengkap#
dengan Test dan Build#
name: CI/CD Pipeline
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- 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 tests
run: npm test
- name: Run linting
run: npm run lint
deploy:
needs: test
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy to Helipod
run: |
curl -X POST "https://api.helipod.io/v1/deploy" \
-H "Authorization: Bearer ${{ secrets.HELIPOD_API_KEY }}" \
-H "Content-Type: application/json" \
-d '{"project": "${{ secrets.HELIPOD_PROJECT }}"}'
dengan Build Status Badge#
name: CI/CD Pipeline
on:
push:
branches: [main]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install & Build
run: |
npm ci
npm run build
- name: Run Tests
run: npm test
- name: Deploy to Helipod
if: success()
run: |
curl -X POST "https://api.helipod.io/v1/deploy" \
-H "Authorization: Bearer ${{ secrets.HELIPOD_API_KEY }}" \
-H "Content-Type: application/json" \
-d '{"project": "${{ secrets.HELIPOD_PROJECT }}"}'
Tambahkan badge ke README:

dengan Environment Promotion#
name: Deploy Pipeline
on:
push:
branches: [main]
jobs:
deploy-staging:
runs-on: ubuntu-latest
environment: staging
steps:
- uses: actions/checkout@v4
- name: Deploy to Staging
run: |
curl -X POST "https://api.helipod.io/v1/deploy" \
-H "Authorization: Bearer ${{ secrets.HELIPOD_STAGING_KEY }}" \
-H "Content-Type: application/json" \
-d '{"project": "my-app-staging"}'
deploy-production:
needs: deploy-staging
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v4
- name: Deploy to Production
run: |
curl -X POST "https://api.helipod.io/v1/deploy" \
-H "Authorization: Bearer ${{ secrets.HELIPOD_PROD_KEY }}" \
-H "Content-Type: application/json" \
-d '{"project": "my-app-production"}'
Cara Alternatif: Webhook#
Selain API, Helipod juga support webhook deployment. Kamu bisa trigger deploy dari GitHub Actions tanpa API key:
- name: Trigger Helipod Deploy
run: |
curl -X POST "${{ secrets.HELIPOD_WEBHOOK_URL }}"
Setup webhook:
- Helipod Dashboard → Settings → Deployments
- Copy webhook URL
- Tambahkan ke GitHub Secrets sebagai
HELIPOD_WEBHOOK_URL
Monitoring Deployment#
Cek Status dari GitHub#
GitHub Actions menunjukkan status setiap run:
- ✅ Success: deployment berhasil
- ❌ Failed: ada error
- 🔄 In progress: sedang build/deploy
Cek Status dari Helipod#
Helipod Dashboard → pilih project → tab Deployments
Lihat:
- Build status
- Deploy time
- Commit message
- Author
Best Practice#
1. Deploy Hanya dari Main Branch#
on:
push:
branches: [main] # Hanya deploy dari main
2. Jalankan Test Sebelum Deploy#
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm test
deploy:
needs: test # Deploy hanya jika test berhasil
steps:
- name: Deploy
run: ...
3. Gunakan Environment Variables#
- name: Deploy
env:
HELIPOD_API_KEY: ${{ secrets.HELIPOD_API_KEY }}
run: |
curl -X POST "https://api.helipod.io/v1/deploy" \
-H "Authorization: Bearer $HELIPOD_API_KEY" \
...
4. Cache Dependencies#
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm' # Cache npm dependencies
5. Notification#
- name: Notify on failure
if: failure()
run: |
curl -X POST "${{ secrets.SLACK_WEBHOOK }}" \
-d '{"text": "Deploy failed!"}'
Troubleshooting#
"Workflow not triggering"#
- Pastikan file ada di
.github/workflows/ - Pastikan branch name benar
- Cek syntax YAML
"Deploy failed"#
- Cek API key benar
- Cek project name benar
- Cek logs GitHub Actions
"Build slow"#
- Cache dependencies
- Gunakan
npm cibukannpm install - Skip test di deploy branch
FAQ#
Apakah GitHub Actions gratis?#
Ya, untuk repo public. Untuk private repo: 2000 menit/bulan gratis.
Bisa pakai GitLab CI?#
Ya. Helipod support GitLab juga. Setup pipeline di .gitlab-ci.yml.
Apakah deploy otomatis dari GitHub?#
Ya. Helipod auto-deploy dari GitHub webhook saat push ke branch yang diatur.
Bagaimana dengan rollback?#
Rollback dari Helipod dashboard, satu klik. Tidak perlu rollback dari GitHub Actions.
Kesimpulan#
CI/CD dengan GitHub Actions menghilangkan manual deployment. Push code → otomatis build → test → deploy. Lebih cepat, lebih aman, dan lebih reliable.
Mulai setup di helipod.io, tidak perlu kartu kredit.
Punya pertanyaan? Hubungi kami di support@helipod.io atau bergabung ke komunitas di hangar.helipod.io.