Skip to content

Commit de7c687

Browse files
fix depolyment
Signed-off-by: saurabhraghuvanshii <saurabhsraghuvanshi@gmail.com>
1 parent f6be21b commit de7c687

File tree

2 files changed

+19
-16
lines changed

2 files changed

+19
-16
lines changed

.github/workflows/build-and-deploy-site.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ jobs:
3030

3131
- name: Build Gatsby site
3232
run: |
33-
PATH_PREFIX=layer5 npm run build:gh-pages
33+
npm run build
34+
echo "drawnew.xyz" > public/CNAME
3435
touch public/.nojekyll
3536
3637
- name: Deploy to GitHub Pages

.github/workflows/build-and-preview-site.yml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build and Preview Gatsby Site
1+
name: PR Preview Deployment (Gatsby + GitHub Pages)
22

33
on:
44
pull_request_target:
@@ -10,21 +10,22 @@ permissions:
1010
pull-requests: write
1111

1212
concurrency:
13-
group: "preview-${{ github.event.pull_request.number || github.run_id }}"
13+
group: preview-${{ github.event.pull_request.number || github.run_id }}
1414
cancel-in-progress: true
1515

1616
jobs:
17-
build-and-deploy-preview:
17+
preview:
1818
runs-on: ubuntu-latest
1919

2020
steps:
21+
2122
- name: Checkout PR
2223
if: github.event.action != 'closed'
2324
uses: actions/checkout@v4
2425
with:
2526
ref: ${{ github.event.pull_request.head.sha }}
2627

27-
- name: Checkout for cleanup
28+
- name: Checkout gh-pages for cleanup
2829
if: github.event.action == 'closed'
2930
uses: actions/checkout@v4
3031
with:
@@ -40,20 +41,23 @@ jobs:
4041
if: github.event.action != 'closed'
4142
run: npm ci
4243

44+
- name: Set PATH_PREFIX
45+
if: github.event.action != 'closed'
46+
run: echo "PATH_PREFIX=layer5" >> $GITHUB_ENV
47+
4348
- name: Build PR preview
4449
if: github.event.action != 'closed'
50+
env:
51+
GATSBY_PREVIEW: "true"
52+
GATSBY_SITE_URL: https://${{ github.repository_owner }}.github.io
4553
run: |
46-
PATH_PREFIX=layer5 npm run build:preview
54+
PATH_PREFIX=$PATH_PREFIX npm run build:preview
4755
4856
# Prevent indexing
49-
cat > public/robots.txt <<'EOF'
50-
User-agent: *
51-
Disallow: /
52-
EOF
57+
echo -e "User-agent: *\nDisallow: /" > public/robots.txt
5358
5459
- name: Deploy PR preview
5560
if: github.event.action != 'closed'
56-
id: deploy-preview
5761
uses: rossjrw/pr-preview-action@v1.6.3
5862
with:
5963
source-dir: ./public
@@ -68,13 +72,11 @@ jobs:
6872
with:
6973
header: pr-preview
7074
message: |
71-
🚀 **Preview deployment for PR #${{ github.event.pull_request.number }}**
72-
73-
🌐 **Preview URL**: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr-preview/pr-${{ github.event.pull_request.number }}/
75+
🚀 **Preview for PR #${{ github.event.pull_request.number }}**
7476
75-
_This preview will be updated automatically when you push new commits to this PR._
77+
🌐 https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/pr-preview/pr-${{ github.event.pull_request.number }}/
7678
77-
- name: Cleanup PR preview on close
79+
- name: Cleanup PR preview
7880
if: github.event.action == 'closed'
7981
uses: rossjrw/pr-preview-action@v1.6.3
8082
with:

0 commit comments

Comments
 (0)