fix: staging deploy via needs no CI, não workflow_run
Some checks failed
CI / static (push) Successful in 2m35s
CI / unit (push) Successful in 3m36s
CI / feature (push) Successful in 2m31s
CI / container (push) Successful in 1m0s
CI / browser (push) Successful in 4m11s
CI / deploy-staging (push) Failing after 6m19s

workflow_run nunca disparou no Gitea 1.24 com CI multi-job.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-12 15:33:29 -03:00
parent 91c0d412fa
commit ac08b5f064
3 changed files with 26 additions and 14 deletions

View File

@@ -275,3 +275,18 @@ jobs:
docker logs "$HEALTH_NAME" docker logs "$HEALTH_NAME"
exit 1 exit 1
# Staging deploy runs in-process after gates. workflow_run never fired on
# this Gitea 1.24 multi-job CI setup (0 deploy runs after green CI).
deploy-staging:
name: deploy-staging
needs: [static, unit, feature, browser, container]
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/main'
uses: ./.gitea/workflows/deploy-staging.yml
secrets:
REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
REGISTRY_PAT: ${{ secrets.REGISTRY_PAT }}
DOKPLOY_URL: ${{ secrets.DOKPLOY_URL }}
DOKPLOY_API_KEY: ${{ secrets.DOKPLOY_API_KEY }}
DOKPLOY_STAGING_COMPOSE_ID: ${{ secrets.DOKPLOY_STAGING_COMPOSE_ID }}
STAGING_URL: ${{ secrets.STAGING_URL }}

View File

@@ -1,10 +1,11 @@
name: Deploy staging name: Deploy staging
# Invoked from ci.yml after all gates pass on main (workflow_call).
# workflow_run is unreliable on Gitea 1.24 with multi-job CI (never fired).
# workflow_dispatch keeps a manual re-deploy path.
on: on:
workflow_run: workflow_call:
workflows: [CI] workflow_dispatch:
types: [completed]
branches: [main]
permissions: permissions:
contents: read contents: read
@@ -21,21 +22,15 @@ env:
jobs: jobs:
deploy: deploy:
name: publish-and-deploy-staging name: publish-and-deploy-staging
if: >-
gitea.event.workflow_run.conclusion == 'success' &&
gitea.event.workflow_run.event == 'push' &&
gitea.event.workflow_run.head_branch == 'main'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout deployed SHA - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
ref: ${{ gitea.event.workflow_run.head_sha }}
- name: Set image metadata - name: Set image metadata
id: meta id: meta
run: | run: |
SHA="${{ gitea.event.workflow_run.head_sha }}" SHA="${{ gitea.sha }}"
SHORT_SHA="${SHA:0:7}" SHORT_SHA="${SHA:0:7}"
IMAGE="${REGISTRY}/${IMAGE_NAME}" IMAGE="${REGISTRY}/${IMAGE_NAME}"
IMAGE="$(echo "$IMAGE" | tr '[:upper:]' '[:lower:]')" IMAGE="$(echo "$IMAGE" | tr '[:upper:]' '[:lower:]')"

View File

@@ -154,13 +154,15 @@ Parallel CI jobs need the act_runner `config.yaml` to keep `container.network` *
### Staging (automatic) ### Staging (automatic)
[`.gitea/workflows/deploy-staging.yml`](../../.gitea/workflows/deploy-staging.yml) Job `deploy-staging` in [`.gitea/workflows/ci.yml`](../../.gitea/workflows/ci.yml) (reusable [`.gitea/workflows/deploy-staging.yml`](../../.gitea/workflows/deploy-staging.yml)).
1. Waits for workflow `CI` success (`workflow_run`) on push to `main`. 1. Runs only on push to `main`, after `static`/`unit`/`feature`/`browser`/`container` all succeed (`needs:`). Do **not** rely on `workflow_run` here — it did not fire on Gitea 1.24 with multi-job CI.
2. Builds once; pushes `:<full-sha>` and `:staging` to the Gitea registry. 2. Builds once; pushes `:<full-sha>` and `:staging` to the Gitea registry.
3. Calls Dokploy `compose.deploy` and polls until done. 3. Calls Dokploy `compose.deploy` and polls until done.
4. Runs [`scripts/deploy/smoke.sh`](../../scripts/deploy/smoke.sh) against `STAGING_URL`. 4. Runs [`scripts/deploy/smoke.sh`](../../scripts/deploy/smoke.sh) against `STAGING_URL`.
Manual re-deploy: **Actions → Deploy staging → Run workflow** (`workflow_dispatch`).
### Production (manual) ### Production (manual)
[`.gitea/workflows/promote-production.yml`](../../.gitea/workflows/promote-production.yml) [`.gitea/workflows/promote-production.yml`](../../.gitea/workflows/promote-production.yml)