Skip to content

Commit 66b71f2

Browse files
committed
chore: add some validations and logging information
1 parent b0b1e4a commit 66b71f2

1 file changed

Lines changed: 47 additions & 6 deletions

File tree

.github/workflows/publish-marketplace.yml

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@ jobs:
3333
- name: Grant execute permission for gradlew
3434
run: chmod +x gradlew
3535

36+
- name: Validate required secrets
37+
env:
38+
JETBRAINS_TOKEN: ${{ secrets.JETBRAINS_MARKETPLACE_TOKEN }}
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
run: |
41+
if [ -z "$JETBRAINS_TOKEN" ]; then
42+
echo "Error: JETBRAINS_MARKETPLACE_TOKEN secret is not set"
43+
exit 1
44+
fi
45+
if [ -z "$GITHUB_TOKEN" ]; then
46+
echo "Error: GITHUB_TOKEN secret is not set"
47+
exit 1
48+
fi
49+
echo "✅ Required secrets are available"
50+
3651
- name: Check for changes since last nightly
3752
if: github.event_name == 'schedule'
3853
id: changes_check
@@ -98,7 +113,11 @@ jobs:
98113
if: (github.event_name == 'schedule' && steps.changes_check.outputs.has_changes == 'true') || github.event_name == 'workflow_dispatch'
99114
run: |
100115
echo "Building nightly version from source..."
101-
./gradlew buildPlugin -Pgpr.username=rhdevelopers-ci -Pgpr.token=${{ secrets.GITHUB_TOKEN }} -PprojectVersion=${{ steps.version_info.outputs.VERSION }}
116+
if ! ./gradlew buildPlugin -Pgpr.username=rhdevelopers-ci -Pgpr.token=${{ secrets.GITHUB_TOKEN }} -PprojectVersion=${{ steps.version_info.outputs.VERSION }}; then
117+
echo "Error: Gradle build failed"
118+
exit 1
119+
fi
120+
echo "✅ Build completed successfully"
102121
103122
- name: Skip nightly build
104123
if: github.event_name == 'schedule' && steps.changes_check.outputs.has_changes == 'false'
@@ -114,17 +133,39 @@ jobs:
114133
ZIP_URL="https://github.com/${{ github.repository }}/releases/download/${RELEASE_VERSION}/Dependency-Analytics-${RELEASE_VERSION}.zip"
115134
echo "Downloading from: $ZIP_URL"
116135
mkdir -p build/distributions
117-
curl -L -o "build/distributions/intellij-dependency-analytics-${RELEASE_VERSION}.zip" "$ZIP_URL"
136+
137+
if ! curl -L -f -o "build/distributions/intellij-dependency-analytics-${RELEASE_VERSION}.zip" "$ZIP_URL"; then
138+
echo "Error: Failed to download ZIP file from release"
139+
echo "URL: $ZIP_URL"
140+
exit 1
141+
fi
142+
echo "✅ Downloaded ZIP file successfully"
118143
119144
- name: Verify ZIP file exists
120145
run: |
121146
ls -la build/distributions/
122-
# For stable releases, expect the exact filename
123-
if [ ! -f "build/distributions/intellij-dependency-analytics-${{ steps.version_info.outputs.VERSION }}.zip" ]; then
124-
echo "Error: ZIP file not found!"
147+
ZIP_FILE="build/distributions/intellij-dependency-analytics-${{ steps.version_info.outputs.VERSION }}.zip"
148+
149+
if [ ! -f "$ZIP_FILE" ]; then
150+
echo "Error: ZIP file not found: $ZIP_FILE"
151+
echo "Available files:"
152+
ls -la build/distributions/ || echo "No files found in build/distributions/"
153+
exit 1
154+
fi
155+
156+
# Verify the ZIP file is not empty and is a valid ZIP
157+
if [ ! -s "$ZIP_FILE" ]; then
158+
echo "Error: ZIP file is empty: $ZIP_FILE"
125159
exit 1
126160
fi
127-
echo "✅ ZIP file verified: build/distributions/intellij-dependency-analytics-${{ steps.version_info.outputs.VERSION }}.zip"
161+
162+
if ! file "$ZIP_FILE" | grep -q "Zip archive"; then
163+
echo "Error: File is not a valid ZIP archive: $ZIP_FILE"
164+
file "$ZIP_FILE"
165+
exit 1
166+
fi
167+
168+
echo "✅ ZIP file verified: $ZIP_FILE"
128169
129170
- name: Publish to JetBrains Marketplace
130171
if: steps.version_info.outputs.CHANNEL != 'none'

0 commit comments

Comments
 (0)