File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Verify Secrets
2+ on : workflow_dispatch
3+
4+ jobs :
5+ verify :
6+ runs-on : ubuntu-latest
7+ steps :
8+ - name : Verify Secrets Presence
9+ run : |
10+ if [ -n "${{ secrets.OSSRH_TOKEN_USERNAME }}" ]; then echo "OSSRH_TOKEN_USERNAME is set"; else echo "OSSRH_TOKEN_USERNAME is MISSING"; fi
11+ if [ -n "${{ secrets.OSSRH_TOKEN_PASSWORD }}" ]; then echo "OSSRH_TOKEN_PASSWORD is set"; else echo "OSSRH_TOKEN_PASSWORD is MISSING"; fi
12+
13+ - name : Test Connection to OSSRH
14+ run : |
15+ echo "Testing authentication with OSSRH..."
16+ # 尝试访问 OSSRH 状态接口,如果返回 200 则说明账号密码正确
17+ HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -u "${{ secrets.OSSRH_TOKEN_USERNAME }}:${{ secrets.OSSRH_TOKEN_PASSWORD }}" "https://ossrh-staging-api.central.sonatype.com/service/local/status")
18+ echo "HTTP Status Code: $HTTP_CODE"
19+
20+ if [ "$HTTP_CODE" -eq 200 ]; then
21+ echo "Authentication SUCCESSFUL!"
22+ else
23+ echo "Authentication FAILED! Status code: $HTTP_CODE"
24+ echo "Please check your OSSRH_TOKEN_USERNAME and OSSRH_TOKEN_PASSWORD secrets."
25+ exit 1
26+ fi
You can’t perform that action at this time.
0 commit comments