Skip to content

Commit 33cd162

Browse files
committed
quick fixes
1 parent 7e7a811 commit 33cd162

File tree

2 files changed

+62
-2
lines changed

2 files changed

+62
-2
lines changed

.github/workflows/pr-preview.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,21 @@ jobs:
102102
echo "Verifying Docker image was built successfully..."
103103
docker images | grep wrongsecrets-pr || echo "No wrongsecrets-pr images found"
104104
105+
- name: Save Docker image as artifact
106+
run: |
107+
echo "Saving Docker image as tar artifact..."
108+
IMAGE_TAG="${{ steps.meta.outputs.tags }}" | head -n1
109+
docker save "$IMAGE_TAG" -o wrongsecrets-preview.tar
110+
echo "Docker image saved to wrongsecrets-preview.tar"
111+
ls -lh wrongsecrets-preview.tar
112+
113+
- name: Upload Docker image artifact
114+
uses: actions/upload-artifact@v4
115+
with:
116+
name: wrongsecrets-preview-pr-${{ github.event.number }}
117+
path: wrongsecrets-preview.tar
118+
retention-days: 30
119+
105120
# Comment out Render deployment for now
106121
# - name: Deploy to Render (Preview)
107122
# env:
@@ -130,16 +145,25 @@ jobs:
130145
script: |
131146
const prNumber = context.issue.number;
132147
const imageTag = `${{ steps.meta.outputs.tags }}`.split('\n')[0];
148+
const runId = context.runId;
133149
134150
const comment = `🔨 **Preview Build Complete!**
135151
136152
Your changes have been built and pushed to GitHub Container Registry.
137153
138154
**🐳 Docker Image:** \`${imageTag}\`
139155
140-
**🚀 To test locally:**
156+
**� Download & Test Locally:**
157+
1. [📁 Download Docker Image Artifact](https://github.com/${{ github.repository }}/actions/runs/${runId}) (look for \`wrongsecrets-preview-pr-${prNumber}\`)
158+
2. Load and run the image:
159+
\`\`\`bash
160+
# Download the artifact, extract it, then:
161+
docker load < wrongsecrets-preview.tar
162+
docker run -p 8080:8080 wrongsecrets-preview
163+
\`\`\`
164+
165+
**🚀 Alternative - Pull from Registry:**
141166
\`\`\`bash
142-
# Pull and run the preview image
143167
docker pull ${imageTag}
144168
docker run -p 8080:8080 ${imageTag}
145169
\`\`\`

test-workflow.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
set -e
3+
4+
echo "🔧 Testing workflow commands locally..."
5+
6+
# Make sure Maven wrapper is executable
7+
chmod +x ./mvnw
8+
9+
# Extract version
10+
echo "📦 Extracting version from pom.xml..."
11+
VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
12+
echo "Version: $VERSION"
13+
14+
# Verify the version format
15+
if [[ -z "$VERSION" ]]; then
16+
echo "❌ Version extraction failed"
17+
exit 1
18+
fi
19+
20+
echo "✅ Version extracted successfully: $VERSION"
21+
22+
# Test compilation (without running full package to save time)
23+
echo "🏗️ Testing compilation..."
24+
./mvnw compile -q
25+
26+
echo "✅ Compilation successful"
27+
28+
# Check if target directory exists
29+
if [[ -d "target" ]]; then
30+
echo "✅ Target directory exists"
31+
else
32+
echo "❌ Target directory missing"
33+
exit 1
34+
fi
35+
36+
echo "🎉 All workflow prerequisite tests passed!"

0 commit comments

Comments
 (0)