Skip to content

Commit dafab61

Browse files
committed
deploy, pre-commit scripts tweaked
1 parent bd4938c commit dafab61

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

.githooks/pre-commit

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
#!/bin/sh
2-
# to enable:
3-
# git config core.hooksPath .githooks
4-
# Define the maximum allowed file size in bytes (e.g., 10MB)
5-
# MAX_FILE_SIZE_BYTES=10485760
6-
MAX_FILE_SIZE_BYTES=1048
1+
#!/bin/sh
2+
# to enable this hook run:
3+
# git config core.hooksPath .githooks
4+
# also, run this: git config --global core.excludesfile ~/.gitignore_global
5+
# Define the maximum allowed file size in bytes (e.g., 10MB)
6+
MAX_FILE_SIZE_BYTES=10485760
77

8-
# Get a list of added files in the current commit
9-
ADDED_FILES=$(git diff --cached --name-only --diff-filter=A)
8+
# Get a list of added files in the current commit
9+
ADDED_FILES=$(git diff --cached --name-only --diff-filter=A)
1010

11-
for FILE in $ADDED_FILES; do
12-
if [ -f "$FILE" ]; then
13-
FILE_SIZE=$(wc -c < "$FILE")
14-
if [ "$FILE_SIZE" -gt "$MAX_FILE_SIZE_BYTES" ]; then
15-
echo "Error: File '$FILE' is too large ($FILE_SIZE bytes). Maximum allowed size is $MAX_FILE_SIZE_BYTES bytes."
16-
exit 1 # Exit with a non-zero status to prevent the commit
17-
fi
11+
for FILE in $ADDED_FILES; do
12+
if [ -f "$FILE" ]; then
13+
FILE_SIZE=$(wc -c < "$FILE")
14+
if [ "$FILE_SIZE" -gt "$MAX_FILE_SIZE_BYTES" ]; then
15+
echo "Error: File '$FILE' is too large ($FILE_SIZE bytes). Maximum allowed size is $MAX_FILE_SIZE_BYTES bytes."
16+
exit 1 # Exit with a non-zero status to prevent the commit
1817
fi
19-
done
18+
fi
19+
done
2020

21-
exit 0 # Allow the commit to proceed
21+
exit 0 # Allow the commit to proceed

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Deploy to Surge
1+
name: Build and Deploy to Surge
22

33
on:
44
push:
@@ -13,7 +13,7 @@ jobs:
1313
- uses: actions/setup-node@v3
1414
with:
1515
node-version: 22 # Or your desired Node.js version
16-
- name: Get Date
16+
- name: Insert Build Date on main page
1717
run: DATE=`date` && sed "s/A thing made by John Kraus/A thing made by John Kraus - Built on $DATE/g" src/main.tsx >> src/main2.tsx && cp src/main2.tsx src/main.tsx
1818
- name: Install Dependencies
1919
run: npm install

0 commit comments

Comments
 (0)