diff --git a/deploy-to-apps.example.sh b/deploy-to-apps.example.sh index 9ebb94d..2e1b019 100644 --- a/deploy-to-apps.example.sh +++ b/deploy-to-apps.example.sh @@ -40,6 +40,22 @@ if [ -z "$SAAC_API_KEY" ]; then exit 1 fi +if [ -z "$GITEA_API_TOKEN" ]; then + echo "❌ Error: GITEA_API_TOKEN environment variable not set" + echo "" + echo "GITEA_API_TOKEN is required for:" + echo " - Cloning your private repository" + echo " - Setting up automatic deployment webhooks" + echo "" + echo "To get your Gitea API token:" + echo "1. Go to https://git.startanaicompany.com" + echo "2. Click your profile → Settings → Applications" + echo "3. Generate New Token (grant 'repo' permissions)" + echo "4. Export it: export GITEA_API_TOKEN='your_token_here'" + echo "" + exit 1 +fi + # Check required .env variables if [ -z "$COMPANY_NAME" ]; then echo "❌ Error: COMPANY_NAME not set in .env" @@ -90,6 +106,7 @@ APP_RESPONSE=$(curl -s -X POST "${SAAC_API}/applications" \ \"domain_suffix\": \"recruit.startanaicompany.com\", \"git_repository\": \"${REPO_URL}\", \"git_branch\": \"master\", + \"git_token\": \"${GITEA_API_TOKEN}\", \"template_type\": \"recruitment\", \"environment_variables\": { \"COMPANY_NAME\": \"${COMPANY_NAME}\", @@ -130,20 +147,6 @@ echo "" # Configure webhook for automatic deployments echo "🪝 Setting up deployment webhook..." -if [ -z "$GITEA_API_TOKEN" ]; then - echo "❌ Error: GITEA_API_TOKEN environment variable not set" - echo "" - echo "Automatic deployments require GITEA_API_TOKEN to set up webhooks." - echo "" - echo "To get your Gitea API token:" - echo "1. Go to https://git.startanaicompany.com" - echo "2. Click your profile → Settings → Applications" - echo "3. Generate New Token (grant 'repo' permissions)" - echo "4. Export it: export GITEA_API_TOKEN='your_token_here'" - echo "" - exit 1 -fi - # Create webhook in Gitea GITEA_API="https://git.startanaicompany.com/api/v1" WEBHOOK_RESPONSE=$(curl -s -X POST "${GITEA_API}/repos/${GITEA_USERNAME}/${GITEA_REPO_NAME}/hooks" \