From 4f741c0a898bb79104181ba3451bc118499b7c7b Mon Sep 17 00:00:00 2001 From: Aleksandr Meshchriakov Date: Tue, 28 Apr 2026 11:23:36 +0200 Subject: [PATCH] ci: expose dev manual actions on default branch --- .gitea/workflows/ci-cd.yml | 60 +++++++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 10 deletions(-) diff --git a/.gitea/workflows/ci-cd.yml b/.gitea/workflows/ci-cd.yml index 45b252e..644184b 100644 --- a/.gitea/workflows/ci-cd.yml +++ b/.gitea/workflows/ci-cd.yml @@ -10,15 +10,31 @@ on: branches: - main - dev + workflow_dispatch: + inputs: + manual_action: + description: "Manual action: dokploy_start or cleanup_dev_database" + required: true + default: "dokploy_start" + dokploy_target: + description: "Dokploy dev target: all, web, or celery" + required: true + default: "all" + cleanup_confirm: + description: "Type CLEAN_DEV_DB to drop and recreate the dev public schema" + required: false + default: "" env: PYTHON_VERSION: "3.11" + UV_VERSION: "0.7.2" + PIP_DISABLE_PIP_VERSION_CHECK: "1" jobs: lint: name: Code Quality Checks runs-on: ubuntu-latest - if: ${{ !contains(github.event.head_commit.message, '#no_lint') }} + if: ${{ github.event_name != 'workflow_dispatch' && !contains(github.event.head_commit.message, '#no_lint') }} env: TG_BOT_KEY: ${{ secrets.TG_BOT_KEY }} TG_CHANNEL: ${{ secrets.TG_CHANNEL }} @@ -39,15 +55,20 @@ jobs: add-apt-repository -y ppa:deadsnakes/ppa apt-get update apt-get install -y python3.11 python3.11-venv - curl -LsSf https://astral.sh/uv/install.sh | sh - name: Create virtual environment and install dependencies run: | set -euo pipefail - export PATH="$HOME/.local/bin:$PATH" - uv venv --python python3.11 + python3.11 -m venv .venv . .venv/bin/activate - uv sync --dev --frozen + python -m pip install "uv==${UV_VERSION}" + uv sync \ + --dev \ + --frozen \ + --active \ + --python "$(command -v python3.11)" \ + --no-managed-python \ + --no-python-downloads - name: Run Ruff linting run: | @@ -82,7 +103,7 @@ jobs: test: name: Run Tests runs-on: ubuntu-latest - if: ${{ !contains(github.event.head_commit.message, '#no_test') }} + if: ${{ github.event_name != 'workflow_dispatch' && !contains(github.event.head_commit.message, '#no_test') }} env: TG_BOT_KEY: ${{ secrets.TG_BOT_KEY }} TG_CHANNEL: ${{ secrets.TG_CHANNEL }} @@ -103,15 +124,20 @@ jobs: add-apt-repository -y ppa:deadsnakes/ppa apt-get update apt-get install -y python3.11 python3.11-venv - curl -LsSf https://astral.sh/uv/install.sh | sh - name: Create virtual environment and install dependencies run: | set -euo pipefail - export PATH="$HOME/.local/bin:$PATH" - uv venv --python python3.11 + python3.11 -m venv .venv . .venv/bin/activate - uv sync --dev --frozen + python -m pip install "uv==${UV_VERSION}" + uv sync \ + --dev \ + --frozen \ + --active \ + --python "$(command -v python3.11)" \ + --no-managed-python \ + --no-python-downloads - name: Run Django tests env: @@ -147,6 +173,7 @@ jobs: needs: [lint, test] if: | always() && + github.event_name != 'workflow_dispatch' && needs.lint.result == 'success' && needs.test.result == 'success' env: @@ -172,3 +199,16 @@ jobs: curl -fsS -X POST "https://api.telegram.org/bot${TG_BOT_KEY}/sendMessage" \ -d "chat_id=${TG_CHANNEL}" \ --data-urlencode "text=${MSG}" + + manual_actions_require_dev: + name: Manual Actions Require Dev Branch + runs-on: ubuntu-latest + if: ${{ github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/dev' }} + + steps: + - name: Explain manual action branch + run: | + set -euo pipefail + echo "Manual actions are implemented in the dev workflow." + echo "Run this workflow with branch/ref dev." + exit 1