Skip to content

Commit a10dc28

Browse files
fix: remove empty spaces from htaccess (#303)
1 parent 2217c3d commit a10dc28

File tree

2 files changed

+36
-13
lines changed

2 files changed

+36
-13
lines changed

.github/workflows/preview-build.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,6 @@ jobs:
3131
npm ci
3232
npm run build
3333
34-
- name: 📝 Create .htaccess for SPA routing
35-
run: |
36-
cat > ./build/.htaccess << 'EOF'
37-
<IfModule mod_rewrite.c>
38-
RewriteEngine On
39-
RewriteBase /${{ github.event.pull_request.number }}/
40-
41-
RewriteCond %{REQUEST_FILENAME} !-f
42-
RewriteCond %{REQUEST_FILENAME} !-d
43-
RewriteRule ^ index.html [L]
44-
</IfModule>
45-
EOF
46-
4734
- name: 📦 Upload build artifact
4835
uses: actions/upload-artifact@v4
4936
with:

.github/workflows/preview-deploy.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,21 @@ jobs:
2222
id: pr
2323
run: echo "number=$(cat pr_number.txt)" >> $GITHUB_OUTPUT
2424

25+
- name: 📝 Create .htaccess for SPA routing
26+
env:
27+
PULL_NUMBER: ${{ steps.pr.outputs.number }}
28+
run: |
29+
cat > ./build/.htaccess << 'EOF'
30+
<IfModule mod_rewrite.c>
31+
RewriteEngine On
32+
RewriteBase /${PULL_NUMBER}/
33+
34+
RewriteCond %{REQUEST_FILENAME} !-f
35+
RewriteCond %{REQUEST_FILENAME} !-d
36+
RewriteRule ^ index.html [L]
37+
</IfModule>
38+
EOF
39+
2540
- name: 🚀 Deploy preview
2641
env:
2742
PULL_NUMBER: ${{ steps.pr.outputs.number }}
@@ -30,6 +45,27 @@ jobs:
3045
ssh-add - <<< "${{ secrets.PREVIEW_SSH_PRIVATE_KEY }}"
3146
rsync -r --delete --rsync-path="mkdir -p ${{ vars.PREVIEW_HOST_TARGET_DIR }}/$PULL_NUMBER && rsync" -e "ssh -o StrictHostKeyChecking=no" ./build/ ${{ vars.PREVIEW_HOST_USERNAME }}@${{ vars.PREVIEW_HOST_IP }}:${{ vars.PREVIEW_HOST_TARGET_DIR }}/$PULL_NUMBER
3247
48+
- name: ✅ Update PR status check
49+
uses: actions/github-script@v7
50+
with:
51+
github-token: ${{ secrets.GITHUB_TOKEN }}
52+
script: |
53+
const prNumber = parseInt('${{ steps.pr.outputs.number }}');
54+
const { data: pr } = await github.rest.pulls.get({
55+
owner: context.repo.owner,
56+
repo: context.repo.repo,
57+
pull_number: prNumber
58+
});
59+
await github.rest.repos.createCommitStatus({
60+
owner: context.repo.owner,
61+
repo: context.repo.repo,
62+
sha: pr.head.sha,
63+
state: 'success',
64+
target_url: `https://valhalla-app-tests.gis-ops.com/${prNumber}`,
65+
description: 'Preview deployed successfully',
66+
context: 'PR Preview Deploy'
67+
});
68+
3369
- name: 🌐 Comment preview URL
3470
uses: actions/github-script@v7
3571
with:

0 commit comments

Comments
 (0)