diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index ee3a19a..09a9b41 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -41,10 +41,10 @@ on: default: '' type: string no_cache: - description: 'Disable Docker build cache' + description: 'Disable Docker build cache (true/false)' required: false - default: false - type: boolean + default: 'false' + type: string git_ref: description: 'Git ref to deploy (branch, tag, or commit SHA; default: main)' required: false @@ -212,14 +212,15 @@ jobs: set -euo pipefail # Auto-deploy: always use cache. Manual: respect no_cache input. - NO_CACHE="${{ github.event_name == 'workflow_dispatch' && inputs.no_cache || false }}" BUILD_ARGS="" - if [ "$NO_CACHE" = "true" ]; then - BUILD_ARGS="--no-cache" + SERVICE_ARG="" + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + if [ "${{ github.event_name == 'workflow_dispatch' && inputs.no_cache || 'false' }}" = "true" ]; then + BUILD_ARGS="--no-cache" + fi + SERVICE_ARG="${{ github.event_name == 'workflow_dispatch' && inputs.service || '' }}" fi - SERVICE_ARG="${{ github.event_name == 'workflow_dispatch' && inputs.service || '' }}" - # Write the deploy script to a file to avoid nested quoting issues cat > /tmp/nexus-deploy-script.sh << 'DEPLOYSCRIPT' #!/bin/sh @@ -235,13 +236,9 @@ docker rm -f nexus-postgres-1 nexus-api-1 nexus-web-1 2>/dev/null || true PG_VOL=$(docker volume ls -q --filter name=nexus-postgres 2>/dev/null | head -1) if [ -n "$PG_VOL" ]; then echo "Checking postgres WAL integrity..." - docker run --rm -v "$PG_VOL:/var/lib/postgresql/data" \ - --entrypoint sh postgres:17-alpine -c " - echo 'Resetting WAL...' - pg_resetwal -f /var/lib/postgresql/data && echo 'WAL reset OK' - " 2>&1 || echo 'pg_resetwal failed (may be benign)' + docker run --rm -v "$PG_VOL:/var/lib/postgresql/data" --entrypoint sh postgres:17-alpine -c "pg_resetwal -f /var/lib/postgresql/data && echo 'WAL reset OK'" 2>&1 || echo "pg_resetwal failed (may be benign)" else - echo 'Postgres volume not found - will be created fresh' + echo "Postgres volume not found - will be created fresh" fi BUILD_ARGS="${DEPLOY_BUILD_ARGS:-}"