diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b0e3883e..e5f0f4ac 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,31 +6,31 @@ stages: default: tags: - - self-hosted-stg + - self-hosted-prod workflow: rules: - - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "staging"' + - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "production"' when: always - when: never variables: DOCKER_BUILDKIT: "1" - IMAGE_TAG: "staging_${CI_COMMIT_SHORT_SHA}" + IMAGE_TAG: "production_${CI_COMMIT_SHORT_SHA}" IMAGE_NAME: "${CI_REGISTRY_IMAGE}:${IMAGE_TAG}" - IMAGE_LATEST: "${CI_REGISTRY_IMAGE}:staging_latest" + IMAGE_LATEST: "${CI_REGISTRY_IMAGE}:production_latest" - DEPLOY_DIR: "/opt/deploy/stg-lti-api" + DEPLOY_DIR: "/opt/deploy/lti" COMPOSE_FILE: "docker-compose.yaml" # ========================= # BUILD (AUTO) # ========================= -build_staging: +build_production: stage: build rules: - - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "staging"' + - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "production"' script: | set -e docker info @@ -51,16 +51,16 @@ build_staging: # ========================= # MIGRATE (AUTO) # ========================= -migrate_staging: +migrate_production: stage: migrate rules: - - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "staging"' + - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "production"' needs: - - job: build_staging + - job: build_production artifacts: false script: | set -e - echo "✅ Running migrations (staging) ..." + echo "✅ Running migrations (production) ..." cd "$DEPLOY_DIR" test -f "$COMPOSE_FILE" || (echo "❌ $COMPOSE_FILE not found in $DEPLOY_DIR" && exit 1) @@ -128,14 +128,14 @@ migrate_staging: # ========================= # DEPLOY (AUTO) # ========================= -deploy_staging: +deploy_production: stage: deploy rules: - - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "staging"' + - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "production"' needs: - - job: migrate_staging + - job: migrate_production artifacts: false - - job: build_staging + - job: build_production artifacts: false script: | set -e @@ -154,12 +154,12 @@ deploy_staging: # ========================= # SEED (MANUAL) # ========================= -seed_staging: +seed_production: stage: seed rules: - - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "staging"' + - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "production"' needs: - - job: deploy_staging + - job: deploy_production artifacts: false when: manual allow_failure: false @@ -170,4 +170,6 @@ seed_staging: test -f .env || (echo "❌ .env not found" && exit 1) docker compose -f "$COMPOSE_FILE" pull seed || true - docker compose -f "$COMPOSE_FILE" run --rm seed \ No newline at end of file + docker compose -f "$COMPOSE_FILE" run --rm seed + +