feat: add deploy-to-Dokploy step in CI/CD pipeline
- Deploy job runs after tests pass, only on push to main - Uses Dokploy compose.deploy API with secrets for URL, token, compose ID - PRs only run tests (no deploy)
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
name: CI
|
name: CI/CD
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -7,7 +7,7 @@ on:
|
|||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-backend:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
@@ -30,3 +30,18 @@ jobs:
|
|||||||
|
|
||||||
- name: Type check
|
- name: Type check
|
||||||
run: bun x tsc --noEmit
|
run: bun x tsc --noEmit
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
needs: test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Deploy to Dokploy
|
||||||
|
run: |
|
||||||
|
curl -fsSL -X POST \
|
||||||
|
"${{ secrets.DOKPLOY_URL }}/api/compose.deploy" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-H "x-api-key: ${{ secrets.DOKPLOY_API_TOKEN }}" \
|
||||||
|
-d '{"composeId": "${{ secrets.DOKPLOY_COMPOSE_ID }}"}'
|
||||||
|
echo "✅ Deploy triggered on Dokploy"
|
||||||
|
|||||||
Reference in New Issue
Block a user