Skip to content

Commit 505013b

Browse files
Merge pull request #29 from Rajesh-Nagarajan-11/revert
revert to github pages deploy
2 parents 0060032 + 590d2a0 commit 505013b

File tree

2 files changed

+51
-53
lines changed

2 files changed

+51
-53
lines changed

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

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,22 @@ name: Build and Preview Site
22
on:
33
pull_request:
44
branches: [master]
5-
types: [opened, synchronize, reopened]
5+
types: [opened, synchronize, reopened, closed]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
permissions:
12+
contents: write
13+
pull-requests: write
614

715
jobs:
8-
site-preview:
16+
build:
917
runs-on: ubuntu-latest
1018
steps:
1119
- name: Checkout 🛎️
12-
uses: actions/checkout@master
20+
uses: actions/checkout@v6
1321

1422
- name: Install and Build 🔧
1523
run: |
@@ -31,4 +39,43 @@ jobs:
3139
with:
3240
name: public-dir
3341
path: public-dir.zip
34-
retention-days: 1
42+
retention-days: 1
43+
44+
preview:
45+
needs: build
46+
runs-on: ubuntu-latest
47+
if: github.event_name == 'pull_request'
48+
steps:
49+
- name: Checkout 🛎️
50+
uses: actions/checkout@v6
51+
52+
- name: Download pre-built site
53+
if: github.event_name == 'pull_request'
54+
uses: actions/download-artifact@v4
55+
with:
56+
name: public-dir
57+
path: .
58+
59+
- name: Extract site
60+
if: github.event_name == 'pull_request'
61+
run: |
62+
unzip -q public-dir.zip
63+
# Ensure the extracted folder has the static files in a 'public' dir for the action
64+
if [ -d "public-dir" ] && [ ! -d "public" ]; then
65+
mv public-dir public
66+
elif [ ! -d "public" ]; then
67+
echo "Warning: Neither public nor public-dir found after extraction"
68+
fi
69+
70+
- name: Deploy Preview
71+
if: github.event_name == 'pull_request' && github.event.action != 'closed'
72+
uses: rossjrw/[email protected]
73+
with:
74+
source-dir: public
75+
76+
- name: Remove Preview on Close
77+
if: github.event_name == 'pull_request' && github.event.action == 'closed'
78+
uses: rossjrw/[email protected]
79+
with:
80+
source-dir: public
81+
remove: true

.github/workflows/preview-site.yml

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)