diff --git a/.github/workflows/build-and-preview-site.yml b/.github/workflows/build-and-preview-site.yml index 7cf0708..530be7a 100644 --- a/.github/workflows/build-and-preview-site.yml +++ b/.github/workflows/build-and-preview-site.yml @@ -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" \ No newline at end of file diff --git a/.github/workflows/preview-site.yml b/.github/workflows/preview-site.yml index 269826c..4cfe2cc 100644 --- a/.github/workflows/preview-site.yml +++ b/.github/workflows/preview-site.yml @@ -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 diff --git a/script.sh b/script.sh index b509bac..6d4d9a7 100644 --- a/script.sh +++ b/script.sh @@ -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"