Add Drone CI pipeline configuration
Some checks failed
continuous-integration/drone/push Build encountered an error
Some checks failed
continuous-integration/drone/push Build encountered an error
This commit is contained in:
88
.drone.yml
Normal file
88
.drone.yml
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: default
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# Step 1: Install dependencies and run tests
|
||||||
|
- name: test
|
||||||
|
image: composer:2
|
||||||
|
commands:
|
||||||
|
- composer install --prefer-dist --no-progress --no-interaction
|
||||||
|
- composer validate --strict
|
||||||
|
- echo "✓ Composer validation passed"
|
||||||
|
# Uncomment when tests are ready:
|
||||||
|
# - php artisan test
|
||||||
|
|
||||||
|
# Step 2: Deploy to staging (on develop/main branch)
|
||||||
|
- name: deploy-staging
|
||||||
|
image: appleboy/drone-ssh
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- develop
|
||||||
|
- main
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
settings:
|
||||||
|
host:
|
||||||
|
from_secret: staging_host
|
||||||
|
user: root
|
||||||
|
key:
|
||||||
|
from_secret: ssh_private_key
|
||||||
|
port: 22
|
||||||
|
script:
|
||||||
|
- /opt/deploy-scripts/deploy-laravel.sh staging main
|
||||||
|
- cd /var/www/laravel/current && php artisan migrate --force
|
||||||
|
|
||||||
|
# Step 3: Deploy to production (manual trigger only)
|
||||||
|
- name: deploy-production
|
||||||
|
image: appleboy/drone-ssh
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- main
|
||||||
|
event:
|
||||||
|
- promote
|
||||||
|
target:
|
||||||
|
- production
|
||||||
|
settings:
|
||||||
|
host:
|
||||||
|
from_secret: production_host
|
||||||
|
user: root
|
||||||
|
key:
|
||||||
|
from_secret: ssh_private_key
|
||||||
|
port: 22
|
||||||
|
script:
|
||||||
|
- /opt/deploy-scripts/deploy-laravel.sh production main
|
||||||
|
- cd /var/www/laravel/current && php artisan migrate --force
|
||||||
|
- cd /var/www/laravel/current && php artisan queue:restart
|
||||||
|
|
||||||
|
# Step 4: Notification
|
||||||
|
- name: notify
|
||||||
|
image: plugins/slack
|
||||||
|
when:
|
||||||
|
status:
|
||||||
|
- success
|
||||||
|
- failure
|
||||||
|
settings:
|
||||||
|
webhook:
|
||||||
|
from_secret: slack_webhook
|
||||||
|
channel: deployments
|
||||||
|
username: Drone CI
|
||||||
|
template: >
|
||||||
|
{{#success build.status}}
|
||||||
|
✓ Laravel API build {{build.number}} succeeded.
|
||||||
|
Branch: {{build.branch}}
|
||||||
|
Commit: {{build.commit}}
|
||||||
|
{{else}}
|
||||||
|
✗ Laravel API build {{build.number}} failed.
|
||||||
|
Branch: {{build.branch}}
|
||||||
|
Commit: {{build.commit}}
|
||||||
|
{{/success}}
|
||||||
|
failure: ignore
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branch:
|
||||||
|
- main
|
||||||
|
- develop
|
||||||
|
event:
|
||||||
|
- push
|
||||||
|
- promote
|
||||||
Reference in New Issue
Block a user