Files
amare/.gitea/workflows/promote-production.yml
manoel freitas f730e766f5
Some checks failed
CI / unit (push) Waiting to run
CI / static (push) Successful in 6m23s
CI / feature (push) Failing after 0s
CI / browser (push) Failing after 0s
CI / container (push) Has been cancelled
fix: secrets de registry sem prefixo GITEA_
Gitea rejeita nomes de secret reservados GITEA_*; workflows
e runbook passam a REGISTRY_PAT / REGISTRY_USER.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-12 14:44:04 -03:00

87 lines
2.6 KiB
YAML

name: Promote production
on:
workflow_dispatch:
inputs:
sha:
description: Full git SHA already published to the Gitea registry (same digest used by staging)
required: true
type: string
confirm:
description: Type PRODUCTION to confirm promotion of the given SHA
required: true
type: string
permissions:
contents: read
packages: write
concurrency:
group: deploy-production
cancel-in-progress: false
env:
REGISTRY: git.hellomanoel.com
IMAGE_NAME: ${{ gitea.repository }}
jobs:
promote:
name: promote-production
runs-on: ubuntu-latest
steps:
- name: Guard confirmation
run: |
if [ "${{ inputs.confirm }}" != "PRODUCTION" ]; then
echo "Confirmation must be exactly PRODUCTION" >&2
exit 1
fi
- name: Checkout repository scripts
uses: actions/checkout@v4
- name: Set image metadata
id: meta
run: |
SHA="${{ inputs.sha }}"
SHORT_SHA="${SHA:0:7}"
IMAGE="${REGISTRY}/${IMAGE_NAME}"
IMAGE="$(echo "$IMAGE" | tr '[:upper:]' '[:lower:]')"
echo "sha=${SHA}" >> "$GITHUB_OUTPUT"
echo "short_sha=${SHORT_SHA}" >> "$GITHUB_OUTPUT"
echo "image=${IMAGE}" >> "$GITHUB_OUTPUT"
- name: Log in to Gitea registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
# Gitea's GITEA_TOKEN cannot push OCI packages (gitea#23642); a PAT
# with read:package/write:package scopes is required instead.
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PAT }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Point :production at existing SHA digest (no rebuild)
run: |
docker buildx imagetools create \
--tag "${{ steps.meta.outputs.image }}:production" \
"${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.sha }}"
- name: Deploy production on Dokploy
env:
DOKPLOY_URL: ${{ secrets.DOKPLOY_URL }}
DOKPLOY_API_KEY: ${{ secrets.DOKPLOY_API_KEY }}
DOKPLOY_COMPOSE_ID: ${{ secrets.DOKPLOY_PRODUCTION_COMPOSE_ID }}
DEPLOY_TITLE: "production ${{ steps.meta.outputs.short_sha }}"
run: |
chmod +x scripts/deploy/dokploy-deploy.sh
./scripts/deploy/dokploy-deploy.sh
- name: Smoke production
env:
SMOKE_BASE_URL: ${{ secrets.PRODUCTION_URL }}
run: |
chmod +x scripts/deploy/smoke.sh
./scripts/deploy/smoke.sh