Skip to content

Commit 432dd2b

Browse files
Merge pull request #122 from SplinterSword/deployPreview
Fixed Deployment Preview Workflow
2 parents 27dda86 + af5c946 commit 432dd2b

4 files changed

Lines changed: 33 additions & 16 deletions

File tree

.github/workflows/build-and-preview-site.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
uses: actions/upload-artifact@v4
2727
with:
2828
name: public-dir
29-
path: ./public-dir.zip
29+
path: public-dir.zip
3030
retention-days: 1
3131
- name: Trigger Inner workflow
3232
run: echo "triggering inner workflow"

.github/workflows/preview-site.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ on:
88

99
jobs:
1010
deploy-preview:
11-
if: github.repository == 'meshery-extensions/shape-builder'
11+
if: >
12+
github.repository == 'meshery-extensions/shape-builder' &&
13+
github.event.workflow_run.conclusion == 'success'
1214
runs-on: ubuntu-24.04
1315
steps:
1416
- name: Checkout code
@@ -24,8 +26,9 @@ jobs:
2426

2527
- name: Unzip Site
2628
run: |
27-
rm -rf ./docs/_site
28-
unzip public-dir.zip
29+
rm -rf docs/_site
30+
mkdir -p docs/_site
31+
unzip public-dir.zip -d docs/_site
2932
rm -f public-dir.zip
3033
3134
- name: Deploy to Netlify

script.sh

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
1-
#! /usr/bin/env bash
1+
#!/usr/bin/env bash
2+
set -e
23

3-
if [ -f public-dir.zip ]; then
4-
rm -rf public-dir.zip
4+
ZIP_NAME="public-dir.zip"
5+
BUILD_DIR="site/public"
6+
7+
# Ensure build output exists and is not empty
8+
if [ ! -d "$BUILD_DIR" ] || [ -z "$(ls -A "$BUILD_DIR")" ]; then
9+
echo "Build output missing or empty at $BUILD_DIR"
10+
exit 1
511
fi
6-
mkdir -p public
7-
zip -r public-dir.zip . -i ./public
12+
13+
rm -f "$ZIP_NAME"
14+
15+
# Zip ONLY the contents of the built site
16+
(
17+
cd "$BUILD_DIR"
18+
zip -r "../../$ZIP_NAME" .
19+
)
20+
21+
echo "Zipped site contents into $ZIP_NAME"

site/src/components/ShapeBuilder/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const ShapeBuilder = () => {
6767

6868
const points = getPlottedPoints(poly);
6969
if (!points || points.length === 0) return;
70-
70+
7171
if (!basePointsRef.current) {
7272
basePointsRef.current = points;
7373
}
@@ -92,10 +92,10 @@ const ShapeBuilder = () => {
9292
const handleScaleChange = (newScale) => {
9393
const clampedScale = Math.max(MIN_SCALE, Math.min(MAX_SCALE, newScale));
9494
setScale(clampedScale);
95-
95+
9696
const matchingPreset = SCALE_PRESETS.find(p => Math.abs(p - clampedScale) < 0.01);
9797
setCurrentPreset(matchingPreset || clampedScale);
98-
98+
9999
applyScale(clampedScale);
100100
};
101101

@@ -250,7 +250,7 @@ const ShapeBuilder = () => {
250250
<Box sx={{ display: "flex", justifyContent: "center", alignItems: "center", gap: 2, mt: 3, mb: 3, flexWrap: "wrap" }}>
251251
<Button variant="contained" onClick={clearShape}>Clear</Button>
252252
<Button variant="contained" onClick={closeShape}>Close Shape</Button>
253-
253+
254254
<Box sx={{ display: "flex", alignItems: "center", gap: 1.5, ml: 2 }}>
255255
<FormControl size="small" sx={{ minWidth: 80 }}>
256256
<Select
@@ -260,9 +260,9 @@ const ShapeBuilder = () => {
260260
displayEmpty
261261
aria-label="Scale preset"
262262
sx={{
263-
color: '#fff',
264-
'& .MuiSelect-icon': {
265-
color: '#fff'
263+
color: "#fff",
264+
"& .MuiSelect-icon": {
265+
color: "#fff"
266266
}
267267
}}
268268
>

0 commit comments

Comments
 (0)