Skip to content

Commit 5c2cde4

Browse files
committed
Fix deployment preview workflow
1 parent a1244e4 commit 5c2cde4

3 files changed

Lines changed: 26 additions & 9 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"

0 commit comments

Comments
 (0)