diff --git a/.gitea/scripts/deploy-for-services.sh b/.gitea/scripts/deploy-for-services.sh new file mode 100755 index 0000000..20415c8 --- /dev/null +++ b/.gitea/scripts/deploy-for-services.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Deploys and restarts a single service or all services. +# +# Usage: ./.gitea/scripts/deploy-for-services.sh +set -euo pipefail + +SERVICE=${1:-} +AGEBD_ENV=${2:-} + +SCRIPT_DIR=$(dirname "$0") + +if [ "${SERVICE}" = "all" ]; then + SERVICES=$(ls -d services/*/ | xargs -n1 basename) +else + SERVICES=${SERVICE} +fi + +for SERVICE_NAME in ${SERVICES}; do + "${SCRIPT_DIR}/deploy-service.sh" "${SERVICE_NAME}" "${AGEBD_ENV}" true +done diff --git a/.gitea/workflows/service.yml b/.gitea/workflows/service.yml new file mode 100644 index 0000000..a51cc1c --- /dev/null +++ b/.gitea/workflows/service.yml @@ -0,0 +1,27 @@ +name: Service + +# Manually re-deploy (and restart) individual services, or all of them, in dev. +# There is deliberately no prod option here - prod deploys go through the +# normal push-to-main flow (see the 'Deploy' workflow), which requires review. +on: + workflow_dispatch: + inputs: + service: + description: "Service name in lower case, or 'all' for every service" + type: string + required: true + +env: + UV_CACHE_DIR: /var/cache/uv + UV_LINK_MODE: hardlink + +jobs: + deploy-dev: + runs-on: hla-dev + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Deploy and restart ${{ inputs.service }} + run: | + ./.gitea/scripts/deploy-for-services.sh "${{ inputs.service }}" "dev"