63 lines
1.3 KiB
YAML
63 lines
1.3 KiB
YAML
name: deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: deploy-${{ github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: self-hosted
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Push-to-deploy op server
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
if [ -z "${DEPLOY_COMPOSE_FILE:-}" ]; then
|
|
DEPLOY_COMPOSE_FILE="docker-compose.yml"
|
|
fi
|
|
|
|
if [ -z "${APP_HOST:-}" ]; then
|
|
APP_HOST="$(hostname -f 2>/dev/null || hostname)"
|
|
fi
|
|
|
|
if [ -z "${APP_SCHEME:-}" ]; then
|
|
APP_SCHEME="http"
|
|
fi
|
|
|
|
if [ -z "${DJANGO_DEBUG:-}" ]; then
|
|
if [ "${APP_SCHEME}" = "https" ]; then
|
|
DJANGO_DEBUG="0"
|
|
else
|
|
DJANGO_DEBUG="1"
|
|
fi
|
|
fi
|
|
|
|
export APP_HOST
|
|
export APP_SCHEME
|
|
export DJANGO_DEBUG
|
|
|
|
export DEPLOY_COMPOSE_FILE
|
|
if [ -n "${APP_ORIGINS:-}" ]; then
|
|
export APP_ORIGINS
|
|
fi
|
|
|
|
if [ -n "${APP_HOSTS:-}" ]; then
|
|
export APP_HOSTS
|
|
fi
|
|
|
|
if [ -n "${APP_PORT:-}" ]; then
|
|
export APP_PORT
|
|
fi
|
|
|
|
bash scripts/deploy_docker.sh "${DEPLOY_COMPOSE_FILE}" .env
|