Add OSSRH token test workflows for debugging deployment issues #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test OSSRH Authentication | |
| on: | |
| workflow_dispatch: # Manual trigger only | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| test-auth: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out src from Git | |
| uses: actions/checkout@v4 | |
| - name: Debug - Check secrets availability | |
| run: | | |
| echo "Testing if secrets are available:" | |
| if [ -n "${{ secrets.OSSRH_USERNAME }}" ]; then | |
| echo "✓ OSSRH_USERNAME is available" | |
| else | |
| echo "✗ OSSRH_USERNAME is missing" | |
| fi | |
| if [ -n "${{ secrets.OSSRH_TOKEN }}" ]; then | |
| echo "✓ OSSRH_TOKEN is available" | |
| else | |
| echo "✗ OSSRH_TOKEN is missing" | |
| fi | |
| - name: Test OSSRH API connection | |
| run: | | |
| echo "Testing OSSRH API connection..." | |
| response=$(curl -s -w "%{http_code}" -u "${{ secrets.OSSRH_USERNAME }}:${{ secrets.OSSRH_TOKEN }}" \ | |
| -H "Accept: application/json" \ | |
| https://oss.sonatype.org/service/local/user/profile) | |
| http_code="${response: -3}" | |
| body="${response%???}" | |
| echo "HTTP Status Code: $http_code" | |
| echo "Response body: $body" | |
| if [ "$http_code" = "200" ]; then | |
| echo "✓ Successfully authenticated with OSSRH" | |
| else | |
| echo "✗ Failed to authenticate with OSSRH (HTTP $http_code)" | |
| exit 1 | |
| fi | |
| - name: Test staging repository access | |
| run: | | |
| echo "Testing staging repository access..." | |
| response=$(curl -s -w "%{http_code}" -u "${{ secrets.OSSRH_USERNAME }}:${{ secrets.OSSRH_TOKEN }}" \ | |
| -H "Accept: application/json" \ | |
| https://oss.sonatype.org/service/local/staging/profile_repositories) | |
| http_code="${response: -3}" | |
| body="${response%???}" | |
| echo "HTTP Status Code: $http_code" | |
| echo "Response body: $body" | |
| if [ "$http_code" = "200" ]; then | |
| echo "✓ Successfully accessed staging repositories" | |
| else | |
| echo "✗ Failed to access staging repositories (HTTP $http_code)" | |
| exit 1 | |
| fi | |
| - name: Check group ID permissions | |
| run: | | |
| echo "Checking permissions for group ID: com.spotify.confidence" | |
| response=$(curl -s -w "%{http_code}" -u "${{ secrets.OSSRH_USERNAME }}:${{ secrets.OSSRH_TOKEN }}" \ | |
| -H "Accept: application/json" \ | |
| https://oss.sonatype.org/service/local/staging/profiles) | |
| http_code="${response: -3}" | |
| body="${response%???}" | |
| echo "HTTP Status Code: $http_code" | |
| if echo "$body" | grep -q "com.spotify.confidence"; then | |
| echo "✓ Found staging profile for com.spotify.confidence" | |
| else | |
| echo "✗ No staging profile found for com.spotify.confidence" | |
| echo "Available profiles:" | |
| echo "$body" | jq -r '.data[] | .name + " (" + .id + ")"' 2>/dev/null || echo "$body" | |
| fi |