Files
probably-rendering-one-more…/.gitea/workflows/ci.yml
T
codex-bot b67574f950
PROMPT Docker CI and deployment / verify-and-deploy (push) Successful in 5m36s
Add cached Web-only releases through existing Docker runtime
2026-10-23 19:45:26 +08:00

73 lines
2.6 KiB
YAML

name: PROMPT Docker CI and deployment
on:
push:
branches: [main]
paths:
- '**'
- '!docs/**'
- '!**/*.md'
- 'public/**'
pull_request:
paths:
- '**'
- '!docs/**'
- '!**/*.md'
- 'public/**'
workflow_dispatch:
jobs:
verify-and-deploy:
runs-on: ces-control
timeout-minutes: 45
env:
PROMPT_IMAGE: prompt:${{ gitea.sha }}
PROMPT_TEST_IMAGE: prompt-tests:${{ gitea.sha }}
RELEASE_SHA: ${{ gitea.sha }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Verify release classification policy
run: bash tests/release-mode.sh
- name: Choose full or Web-only release
id: release
run: |
set -eu
mode=full
if [ "${{ gitea.event_name }}" = push ] && [ "${{ gitea.ref }}" = refs/heads/main ]; then
mode=$(bash scripts/release-mode.sh)
if [ "$mode" = web ]; then
image=$(sed -n 's/^PROMPT_IMAGE=//p' /opt/prompt/current/release.env)
if ! docker image inspect "prompt-tests:${image#prompt:}" >/dev/null 2>&1; then mode=full; fi
fi
fi
echo "mode=$mode" >> "$GITHUB_OUTPUT"
echo "Release mode: $mode"
- name: Build and deploy Web using the existing Docker environment
if: steps.release.outputs.mode == 'web'
run: bash scripts/deploy-web.sh "$RELEASE_SHA"
- name: Check preinstalled Docker Engine and Compose
if: steps.release.outputs.mode != 'web'
run: |
set -eu
command -v docker
docker compose version
docker info >/dev/null
- name: Validate the Compose configuration
if: steps.release.outputs.mode != 'web'
run: docker compose --env-file .env.example config --quiet
- name: Type check, unit tests, production build and smoke test inside Docker
if: steps.release.outputs.mode != 'web'
run: docker build --target integration -t "$PROMPT_TEST_IMAGE" .
- name: Build non-root production image with bundled FFmpeg
if: steps.release.outputs.mode != 'web'
run: docker build --target runtime -t "$PROMPT_IMAGE" .
- name: Test the complete isolated Docker stack
if: steps.release.outputs.mode != 'web'
run: bash scripts/integration.sh
- name: Deploy the persistent Docker Compose stack
if: steps.release.outputs.mode != 'web' && gitea.ref == 'refs/heads/main' && (gitea.event_name == 'push' || gitea.event_name == 'workflow_dispatch')
run: bash scripts/deploy.sh "$RELEASE_SHA"