Files
api-extranetwork/.drone.yml
ExtraNetwork e5ce50ac3b
Some checks failed
continuous-integration/drone/push Build is failing
fix: lock composer platform to php 7.3.0
2026-05-13 09:55:41 +03:00

104 lines
2.9 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

kind: pipeline
type: docker
name: api-extranetwork
# Sadece main branch'te tetiklenir
trigger:
branch:
- main
event:
- push
steps:
# -------------------------------------------------------
# 1. Bağımlılıkları kur
# -------------------------------------------------------
- name: composer-install
image: composer:2.2
volumes:
- name: composer-cache
path: /root/.composer/cache
commands:
- composer config platform.php 7.3.0
- composer install --no-dev --optimize-autoloader --no-interaction --prefer-dist
# -------------------------------------------------------
# 2. PHP Unit testlerini çalıştır
# -------------------------------------------------------
- name: tests
image: php:7.3-cli
commands:
- apt-get update -qq
- apt-get install -y --no-install-recommends libzip-dev libpng-dev libxml2-dev libonig-dev > /dev/null 2>&1
- docker-php-ext-install pdo pdo_mysql zip mbstring > /dev/null 2>&1
- cp .env.example .env
- php artisan key:generate
- vendor/bin/phpunit --no-coverage --stop-on-failure
environment:
DB_CONNECTION: sqlite
DB_DATABASE: ":memory:"
depends_on:
- composer-install
# -------------------------------------------------------
# 3. Docker image build & Gitea Container Registry'e push
# -------------------------------------------------------
- name: docker-build-push
image: plugins/docker
settings:
registry: git.extranetwork.net
repo: git.extranetwork.net/gitea/api-extranetwork
username:
from_secret: gitea
password:
from_secret: TOKEN_GITEA
tags:
- latest
- ${DRONE_COMMIT_SHA:0:8}
build_args:
- APP_ENV=production
depends_on:
- tests
when:
branch:
- main
event:
- push
# -------------------------------------------------------
# 4. SSH ile sunucuya deploy et
# -------------------------------------------------------
- name: deploy
image: appleboy/drone-ssh
settings:
host:
from_secret: DEPLOY_HOST
username:
from_secret: DEPLOY_USER
key:
from_secret: DEPLOY_SSH_KEY
port: 22
script:
- cd /opt/api.extranetwork.com
- docker compose pull
- docker compose up -d --remove-orphans
- docker compose exec -T app php artisan migrate --force
- docker compose exec -T app php artisan config:cache
- docker compose exec -T app php artisan route:cache
- docker compose exec -T app php artisan view:cache
- echo "Deploy tamamlandı - $(date)"
depends_on:
- docker-build-push
when:
branch:
- main
event:
- push
# -------------------------------------------------------
# Uçucu volume (composer cache pipeline içinde paylaşılır)
# -------------------------------------------------------
volumes:
- name: composer-cache
temp: {}