Files
crowdsec-admin/.gitea/workflows/deploy.yml
domverse 3f1d2341ce
Some checks failed
Deploy / deploy (push) Failing after 24s
ci: migrate to Portainer Git stack + registry-pushed image
- Compose: build → image:latest from Gitea registry (ci namespace)
- Workflow: build + push image + POST Portainer webhook (vs. host docker compose up)
- Drop transient .env write — secrets now live in Portainer stack Env
- Add crowdsec@file middleware (defense-in-depth project rule)

Repo secrets required: REGISTRY_TOKEN, PORTAINER_WEBHOOK_URL.
Rollback branch: pre-portainer-migration.
2026-06-20 12:16:56 +02:00

46 lines
1.7 KiB
YAML

# ──────────────────────────────────────────────────────────────────────────────
# CrowdSec Admin — Gitea Actions CI/CD
#
# Build image, push to Gitea registry, trigger Portainer redeploy via webhook.
# Stack itself is managed by Portainer (type=git). Env vars (LAPI creds) live
# in the Portainer stack — NOT in repo secrets — so rotation is one place.
#
# Repo secrets required:
# REGISTRY_TOKEN token for ci user, scope write:package
# PORTAINER_WEBHOOK_URL POST URL from Portainer stack auto-update setting
# ──────────────────────────────────────────────────────────────────────────────
name: Deploy
on:
push:
branches:
- main
workflow_dispatch:
env:
IMAGE: git.domverse-berlin.eu/ci/crowdsec-admin/app
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to Gitea registry
run: echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.domverse-berlin.eu -u ci --password-stdin
- name: Build and push
run: |
docker build -t "$IMAGE:latest" -t "$IMAGE:${{ gitea.sha }}" ./app
docker push "$IMAGE:latest"
docker push "$IMAGE:${{ gitea.sha }}"
- name: Trigger Portainer redeploy
run: |
curl -sk -X POST --fail "${{ secrets.PORTAINER_WEBHOOK_URL }}"
- name: Prune dangling images
run: docker image prune -f