Skip to content

Commit 7577b15

Browse files
committed
wip
1 parent e3a235d commit 7577b15

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

.github/scripts/publish-theme-to-wordpress-org-dry-run.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,25 @@ if [ -d "$THEME_PATH/hello-elementor" ]; then
5959
elif [ -d "hello-elementor" ]; then
6060
BUILD_DIR="hello-elementor"
6161
else
62-
ZIP_FILE=$(find "$THEME_PATH" -maxdepth 1 -name "hello-elementor*.zip" -type f | head -1)
62+
ZIP_FILE=$(find "$THEME_PATH" -maxdepth 2 -name "hello-elementor*.zip" -type f | head -1)
6363
if [ -n "$ZIP_FILE" ]; then
6464
echo "Found zip file, extracting: $ZIP_FILE"
65-
unzip -q "$ZIP_FILE" -d "$THEME_PATH"
66-
if [ -d "$THEME_PATH/hello-elementor" ]; then
65+
TEMP_DIR=$(mktemp -d)
66+
unzip -q "$ZIP_FILE" -d "$TEMP_DIR"
67+
if [ -d "$TEMP_DIR/hello-elementor" ]; then
68+
mv "$TEMP_DIR/hello-elementor" "$THEME_PATH/hello-elementor"
6769
BUILD_DIR="$THEME_PATH/hello-elementor"
70+
elif [ -f "$TEMP_DIR/style.css" ] && [ -f "$TEMP_DIR/functions.php" ]; then
71+
mkdir -p "$THEME_PATH/hello-elementor"
72+
mv "$TEMP_DIR"/* "$THEME_PATH/hello-elementor/" 2>/dev/null || true
73+
BUILD_DIR="$THEME_PATH/hello-elementor"
74+
fi
75+
rm -rf "$TEMP_DIR"
76+
fi
77+
if [ -z "$BUILD_DIR" ]; then
78+
ARTIFACT_DIR=$(find "$THEME_PATH" -type d -name "hello-elementor" 2>/dev/null | head -1)
79+
if [ -n "$ARTIFACT_DIR" ] && [ -f "$ARTIFACT_DIR/style.css" ]; then
80+
BUILD_DIR="$ARTIFACT_DIR"
6881
fi
6982
fi
7083
fi

.github/scripts/publish-theme-to-wordpress-org.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,25 @@ if [ -d "$THEME_PATH/hello-elementor" ]; then
5858
elif [ -d "hello-elementor" ]; then
5959
BUILD_DIR="hello-elementor"
6060
else
61-
ZIP_FILE=$(find "$THEME_PATH" -maxdepth 1 -name "hello-elementor*.zip" -type f | head -1)
61+
ZIP_FILE=$(find "$THEME_PATH" -maxdepth 2 -name "hello-elementor*.zip" -type f | head -1)
6262
if [ -n "$ZIP_FILE" ]; then
6363
echo "Found zip file, extracting: $ZIP_FILE"
64-
unzip -q "$ZIP_FILE" -d "$THEME_PATH"
65-
if [ -d "$THEME_PATH/hello-elementor" ]; then
64+
TEMP_DIR=$(mktemp -d)
65+
unzip -q "$ZIP_FILE" -d "$TEMP_DIR"
66+
if [ -d "$TEMP_DIR/hello-elementor" ]; then
67+
mv "$TEMP_DIR/hello-elementor" "$THEME_PATH/hello-elementor"
6668
BUILD_DIR="$THEME_PATH/hello-elementor"
69+
elif [ -f "$TEMP_DIR/style.css" ] && [ -f "$TEMP_DIR/functions.php" ]; then
70+
mkdir -p "$THEME_PATH/hello-elementor"
71+
mv "$TEMP_DIR"/* "$THEME_PATH/hello-elementor/" 2>/dev/null || true
72+
BUILD_DIR="$THEME_PATH/hello-elementor"
73+
fi
74+
rm -rf "$TEMP_DIR"
75+
fi
76+
if [ -z "$BUILD_DIR" ]; then
77+
ARTIFACT_DIR=$(find "$THEME_PATH" -type d -name "hello-elementor" 2>/dev/null | head -1)
78+
if [ -n "$ARTIFACT_DIR" ] && [ -f "$ARTIFACT_DIR/style.css" ]; then
79+
BUILD_DIR="$ARTIFACT_DIR"
6780
fi
6881
fi
6982
fi

.github/workflows/deploy.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ jobs:
3232
uses: actions/download-artifact@v4
3333
with:
3434
name: hello-elementor
35-
path: .
3635
- name: Validate changelog
3736
env:
3837
VERSION: ${{ env.THEME_VERSION }}

0 commit comments

Comments
 (0)