diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 93f72651..79657ada 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -1,9 +1,6 @@ name: CI - Lint, Typecheck & Test on: - push: - branches-ignore: - - main pull_request: jobs: diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 664f246f..3d54cd30 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -3,18 +3,18 @@ name: Build & Deploy KLZ Cables on: push: branches: - - main + - '**' tags: - 'v*' - workflow_dispatch: - inputs: - skip_long_checks: - description: 'Skip tests? (true/false)' - required: false - default: 'false' + workflow_dispatch: + inputs: + skip_long_checks: + description: 'Skip tests? (true/false)' + required: false + default: 'false' concurrency: - group: ${{ github.workflow }}-${{ (github.ref_type == 'tag' && !contains(github.ref_name, '-')) && 'prod' || (github.ref_type == 'tag' && 'staging' || 'testing') }} + group: ${{ github.workflow }}-${{ (github.ref_type == 'tag' && !contains(github.ref_name, '-')) && 'prod' || (github.ref_type == 'tag' && 'staging' || (github.ref_name == 'main' && 'testing' || github.ref_name)) }} cancel-in-progress: true jobs: @@ -113,6 +113,20 @@ jobs: GOTIFY_TITLE="❓ Unbekannter Tag" GOTIFY_PRIORITY=3 fi + elif [[ "${{ github.ref_type }}" == "branch" ]]; then + TARGET="branch" + # Slugify branch name: lowercase, replace non-alphanumeric with -, remove leading/trailing - + SLUG=$(echo "$TAG" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-//;s/-$//') + IMAGE_TAG="branch-${SLUG}-${SHORT_SHA}" + ENV_FILE=".env.branch-${SLUG}" + TRAEFIK_HOST="${SLUG}.branch.mintel.me" + NEXT_PUBLIC_BASE_URL="https://${SLUG}.branch.mintel.me" + DIRECTUS_URL="https://cms.${SLUG}.branch.mintel.me" + DIRECTUS_HOST="cms.${SLUG}.branch.mintel.me" + PROJECT_NAME="klz-cables-br-${SLUG}" + IS_PROD="false" + GOTIFY_TITLE="🌿 Branch-Deploy ($TAG)" + GOTIFY_PRIORITY=4 else TARGET="skip" fi