Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/build-and-preview-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: public-dir
path: public-dir.zip
path: public-dir
if-no-files-found: error
retention-days: 1
- name: Trigger Inner workflow
run: echo "triggering inner workflow"
7 changes: 3 additions & 4 deletions .github/workflows/preview-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,18 @@ jobs:
uses: actions/checkout@master

- name: Download Site dir
uses: actions/download-artifact@v6
uses: actions/download-artifact@v4
with:
name: public-dir
github-token: ${{ secrets.RELEASE_NOTES_PATN }}
repository: ${{ github.event.workflow_run.repository.full_name }}
run-id: ${{ github.event.workflow_run.id }}

- name: Unzip Site
- name: Prepare Netlify publish directory
run: |
rm -rf docs/_site
mkdir -p docs/_site
unzip public-dir.zip -d docs/_site
rm -f public-dir.zip
cp -r public-dir/. docs/_site/

- name: Deploy to Netlify
id: netlify
Expand Down
25 changes: 15 additions & 10 deletions script.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
#!/usr/bin/env bash
set -e

ZIP_NAME="public-dir.zip"
BUILD_DIR="site/public"
OUT_DIR="public-dir"

# Ensure build output exists and is not empty
if [ ! -d "$BUILD_DIR" ] || [ -z "$(ls -A "$BUILD_DIR")" ]; then
echo "Build output missing or empty at $BUILD_DIR"
if [ ! -d "$BUILD_DIR" ]; then
echo "Build output directory does not exist: $BUILD_DIR"
exit 1
fi

rm -f "$ZIP_NAME"
if [ -z "$(ls -A "$BUILD_DIR")" ]; then
echo "Build output directory is empty: $BUILD_DIR"
exit 1
fi

# Prepare artifact directory
rm -rf "$OUT_DIR"
mkdir -p "$OUT_DIR"

# Zip ONLY the contents of the built site
(
cd "$BUILD_DIR"
zip -r "../../$ZIP_NAME" .
)
# Copy built site contents
cp -r "$BUILD_DIR"/. "$OUT_DIR"/

echo "Zipped site contents into $ZIP_NAME"
echo "Prepared site artifact in $OUT_DIR"
ls -lh "$OUT_DIR"