Skip to content

Commit fd8786e

Browse files
committed
chore: add some validations and logging information
(cherry picked from commit 5d0f62ba42330119b4fabd54342134d81784f57b)
1 parent e6f45a7 commit fd8786e

File tree

1 file changed

+44
-6
lines changed

1 file changed

+44
-6
lines changed

.github/workflows/publish-marketplace.yml

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

36+
- name: Validate required secrets
37+
run: |
38+
if [ -z "${{ secrets.JETBRAINS_MARKETPLACE_TOKEN }}" ]; then
39+
echo "Error: JETBRAINS_MARKETPLACE_TOKEN secret is not set"
40+
exit 1
41+
fi
42+
if [ -z "${{ secrets.GITHUB_TOKEN }}" ]; then
43+
echo "Error: GITHUB_TOKEN secret is not set"
44+
exit 1
45+
fi
46+
echo "✅ Required secrets are available"
47+
3648
- name: Check for changes since last nightly
3749
if: github.event_name == 'schedule'
3850
id: changes_check
@@ -98,7 +110,11 @@ jobs:
98110
if: (github.event_name == 'schedule' && steps.changes_check.outputs.has_changes == 'true') || github.event_name == 'workflow_dispatch'
99111
run: |
100112
echo "Building nightly version from source..."
101-
./gradlew buildPlugin -Pgpr.username=rhdevelopers-ci -Pgpr.token=${{ secrets.GITHUB_TOKEN }} -PprojectVersion=${{ steps.version_info.outputs.VERSION }}
113+
if ! ./gradlew buildPlugin -Pgpr.username=rhdevelopers-ci -Pgpr.token=${{ secrets.GITHUB_TOKEN }} -PprojectVersion=${{ steps.version_info.outputs.VERSION }}; then
114+
echo "Error: Gradle build failed"
115+
exit 1
116+
fi
117+
echo "✅ Build completed successfully"
102118
103119
- name: Skip nightly build
104120
if: github.event_name == 'schedule' && steps.changes_check.outputs.has_changes == 'false'
@@ -114,17 +130,39 @@ jobs:
114130
ZIP_URL="https://github.com/${{ github.repository }}/releases/download/${RELEASE_VERSION}/Dependency-Analytics-${RELEASE_VERSION}.zip"
115131
echo "Downloading from: $ZIP_URL"
116132
mkdir -p build/distributions
117-
curl -L -o "build/distributions/intellij-dependency-analytics-${RELEASE_VERSION}.zip" "$ZIP_URL"
133+
134+
if ! curl -L -f -o "build/distributions/intellij-dependency-analytics-${RELEASE_VERSION}.zip" "$ZIP_URL"; then
135+
echo "Error: Failed to download ZIP file from release"
136+
echo "URL: $ZIP_URL"
137+
exit 1
138+
fi
139+
echo "✅ Downloaded ZIP file successfully"
118140
119141
- name: Verify ZIP file exists
120142
run: |
121143
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!"
144+
ZIP_FILE="build/distributions/intellij-dependency-analytics-${{ steps.version_info.outputs.VERSION }}.zip"
145+
146+
if [ ! -f "$ZIP_FILE" ]; then
147+
echo "Error: ZIP file not found: $ZIP_FILE"
148+
echo "Available files:"
149+
ls -la build/distributions/ || echo "No files found in build/distributions/"
150+
exit 1
151+
fi
152+
153+
# Verify the ZIP file is not empty and is a valid ZIP
154+
if [ ! -s "$ZIP_FILE" ]; then
155+
echo "Error: ZIP file is empty: $ZIP_FILE"
125156
exit 1
126157
fi
127-
echo "✅ ZIP file verified: build/distributions/intellij-dependency-analytics-${{ steps.version_info.outputs.VERSION }}.zip"
158+
159+
if ! file "$ZIP_FILE" | grep -q "Zip archive"; then
160+
echo "Error: File is not a valid ZIP archive: $ZIP_FILE"
161+
file "$ZIP_FILE"
162+
exit 1
163+
fi
164+
165+
echo "✅ ZIP file verified: $ZIP_FILE"
128166
129167
- name: Publish to JetBrains Marketplace
130168
if: steps.version_info.outputs.CHANNEL != 'none'

0 commit comments

Comments
 (0)