68 lines
2.3 KiB
YAML
68 lines
2.3 KiB
YAML
name: 'Deploy Compose App to rack-server'
|
|
description: 'DNS kaydini deploy-panel API si uzerinden garanti eder, Traefik ayarlarini otomatik ekler, "docker compose up -d --build" calistirir ve gercek SSL sertifikasi gelene kadar bekler.'
|
|
|
|
inputs:
|
|
hostname:
|
|
description: 'Uygulamanin public hostname i (orn. myapp.akalan.dev)'
|
|
required: true
|
|
service:
|
|
description: 'docker-compose.yml icinde disari acilacak servisin adi'
|
|
required: false
|
|
default: 'web'
|
|
port:
|
|
description: 'O serviste uygulamanin dinledigi port'
|
|
required: false
|
|
default: '80'
|
|
panel_token:
|
|
description: 'Deploy panel API token (secrets.PANEL_TOKEN)'
|
|
required: true
|
|
panel_url:
|
|
description: 'Deploy panel adresi'
|
|
required: false
|
|
default: 'https://panel.akalan.dev'
|
|
|
|
runs:
|
|
using: 'composite'
|
|
steps:
|
|
- name: DNS kaydini garanti et (panel API uzerinden)
|
|
shell: bash
|
|
env:
|
|
PANEL_TOKEN: ${{ inputs.panel_token }}
|
|
run: |
|
|
set -e
|
|
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST "${{ inputs.panel_url }}/api/ensure-dns" \
|
|
-H "Authorization: Bearer $PANEL_TOKEN" -H "Content-Type: application/json" \
|
|
-d "{\"hostname\":\"${{ inputs.hostname }}\"}")
|
|
BODY=$(echo "$RESPONSE" | head -n -1)
|
|
CODE=$(echo "$RESPONSE" | tail -n1)
|
|
echo "$BODY"
|
|
if [ "$CODE" != "200" ]; then
|
|
echo "::error::DNS ensure basarisiz (HTTP $CODE): $BODY"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Traefik override dosyasi olustur
|
|
shell: bash
|
|
env:
|
|
SERVICE: ${{ inputs.service }}
|
|
HOSTNAME: ${{ inputs.hostname }}
|
|
PORT: ${{ inputs.port }}
|
|
ROUTER_NAME: ${{ github.repository }}
|
|
run: |
|
|
ROUTER_NAME="${ROUTER_NAME##*/}"
|
|
export ROUTER_NAME
|
|
bash ${{ github.action_path }}/../scripts/gen-override.sh
|
|
|
|
- name: docker compose up -d --build
|
|
shell: bash
|
|
run: docker compose -f docker-compose.yml -f .deploy-toolkit-override.yml up -d --build
|
|
|
|
- name: Gercek SSL sertifikasi gelene kadar bekle
|
|
shell: bash
|
|
env:
|
|
PANEL_TOKEN: ${{ inputs.panel_token }}
|
|
run: |
|
|
curl -s -X POST "${{ inputs.panel_url }}/api/wait-for-cert" \
|
|
-H "Authorization: Bearer $PANEL_TOKEN" -H "Content-Type: application/json" \
|
|
-d "{\"hostname\":\"${{ inputs.hostname }}\"}"
|