Skip to content

Commit bc46f1a

Browse files
henmohrwarp-agent
andcommitted
fix: correct asset paths for PR preview subdirectory deployment
Co-Authored-By: Warp <agent@warp.dev>
1 parent 8f60ef1 commit bc46f1a

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

.github/workflows/deploy-pr-preview.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ jobs:
2828
- name: Run composer command
2929
run: composer prod
3030

31+
- name: Fix asset paths for subdirectory deployment
32+
run: |
33+
BASE_PATH="/site-preview/pr-preview/pr-${{ github.event.pull_request.number }}"
34+
find build_production -type f -name "*.html" -exec sed -i "s|href=\"/assets/|href=\"$BASE_PATH/assets/|g" {} +
35+
find build_production -type f -name "*.html" -exec sed -i "s|src=\"/assets/|src=\"$BASE_PATH/assets/|g" {} +
36+
find build_production -type f -name "*.css" -exec sed -i "s|url(/assets/|url($BASE_PATH/assets/|g" {} +
37+
find build_production -type f -name "*.css" -exec sed -i "s|url(\"/assets/|url(\"$BASE_PATH/assets/|g" {} +
38+
3139
- name: Deploy preview
3240
uses: rossjrw/pr-preview-action@v1
3341
with:

0 commit comments

Comments
 (0)