@@ -139,6 +139,13 @@ jobs:
139139 </settings>
140140 EOF
141141 echo "✅ Maven settings.xml configured"
142+
143+ # Verify credentials are set
144+ if [ -z "$SONATYPE_USERNAME" ] || [ -z "$SONATYPE_PASSWORD" ]; then
145+ echo "ERROR: Sonatype credentials not set"
146+ exit 1
147+ fi
148+ echo "✅ Sonatype credentials configured"
142149
143150 - name : Publish to Maven Central
144151 env :
@@ -167,10 +174,46 @@ jobs:
167174 echo "WARNING: GPG signing test failed, but continuing..."
168175 }
169176
177+ # Verify artifacts are built before deploying
178+ echo "Verifying artifacts before deployment..."
179+ mvn clean package -P release \
180+ -Dgpg.keyname="$KEY_ID" \
181+ -Dgpg.passphrase="$GPG_PASSPHRASE" \
182+ -DskipTests
183+
184+ echo "Checking generated artifacts..."
185+ ls -lah target/*.jar target/*.asc target/*.pom 2>/dev/null || echo "No artifacts found in target/"
186+
187+ # Check if version already exists
188+ VERSION=${{ steps.get_version.outputs.version || steps.set_version.outputs.version }}
189+ echo "Checking if version $VERSION already exists..."
190+ if curl -s "https://repo1.maven.org/maven2/io/translateplus/translateplus-java/$VERSION/" | grep -q "$VERSION"; then
191+ echo "⚠️ WARNING: Version $VERSION may already exist on Maven Central"
192+ echo "Continuing anyway (will fail if version truly exists)..."
193+ fi
194+
170195 echo "Publishing to Maven Central..."
171- mvn clean deploy -P release \
196+ echo "This may take several minutes..."
197+ mvn deploy -P release \
172198 -Dgpg.keyname="$KEY_ID" \
173- -Dgpg.passphrase="$GPG_PASSPHRASE"
199+ -Dgpg.passphrase="$GPG_PASSPHRASE" \
200+ -X 2>&1 | tee deploy.log || {
201+ echo "=== Deployment failed ==="
202+ echo "=== Last 100 lines of deploy.log ==="
203+ tail -100 deploy.log
204+ echo ""
205+ echo "=== Searching for error messages ==="
206+ grep -i "error\|fail\|exception" deploy.log | tail -50
207+ echo ""
208+ echo "=== Full error trace (last 200 lines) ==="
209+ mvn deploy -P release \
210+ -Dgpg.keyname="$KEY_ID" \
211+ -Dgpg.passphrase="$GPG_PASSPHRASE" \
212+ -e 2>&1 | tail -200
213+ exit 1
214+ }
215+
216+ echo "✅ Deployment completed successfully!"
174217
175218 - name : Verify publication
176219 run : |
0 commit comments