forked from DJDavid98/HammerTime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add artifacts for standalone execution
- Loading branch information
Showing
5 changed files
with
87 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
yarn build | ||
npm run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"apps": [ | ||
{ | ||
"name": "HammerTime", | ||
"script": "npm start", | ||
"log_date_format": "YYYY-MM-DD HH:mm:ss Z", | ||
"env": { | ||
"PORT": "6901" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
server { | ||
listen 80; | ||
listen 443 ssl http2; | ||
listen [::]:80; | ||
listen [::]:443 ssl http2; | ||
server_name domain.tld; | ||
log_not_found off; | ||
access_log off; | ||
|
||
if ($scheme != 'https'){ | ||
return 302 https://$host$request_uri; | ||
} | ||
|
||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; | ||
add_header X-Frame-Options "sameorigin" always; | ||
add_header X-XSS-Protection "1; mode=block" always; | ||
add_header X-Content-Type-Options "nosniff" always; | ||
|
||
gzip on; | ||
gzip_proxied any; | ||
gzip_comp_level 9; | ||
gzip_types text/plain text/css text/javascript application/json image/svg+xml; | ||
gzip_vary on; | ||
|
||
location / { | ||
proxy_pass http://localhost:6901; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/env bash | ||
echo "##### post-receive hook #####" | ||
read oldrev newrev refname | ||
echo "Push triggered update to revision $newrev ($refname)" | ||
|
||
RUN_FOR_REF="refs/heads/main" | ||
if [[ "$refname" == "$RUN_FOR_REF" ]]; then | ||
GIT="env -i git" | ||
CMD_CD="cd $(readlink -nf "$PWD/..")" | ||
CMD_FETCH="$GIT fetch" | ||
CMD_YARN="npm" | ||
CMD_BUILD="nice npm run build" | ||
CMD_RESTART="pm2 reload pm2.json" | ||
|
||
echo "$ $CMD_CD" | ||
eval ${CMD_CD} | ||
echo "$ $CMD_FETCH" | ||
eval ${CMD_FETCH} | ||
|
||
if $GIT diff --name-only $oldrev $newrev | grep "^package-lock.json"; then | ||
echo "$ $CMD_YARN" | ||
eval $CMD_YARN | ||
else | ||
echo "# Skipping npm install, lockfile not modified" | ||
fi | ||
|
||
if $GIT diff --name-only $oldrev $newrev | grep "^\(src\|public\|package-lock.json\)/"; then | ||
echo "$ $CMD_BUILD" | ||
if eval $CMD_BUILD; then | ||
echo "Build successful" | ||
else | ||
echo "Build failed" | ||
exit 1 | ||
fi | ||
else | ||
echo "# Skipping build, no changes in src or public folders" | ||
fi | ||
|
||
echo "$ $CMD_RESTART" | ||
eval $CMD_RESTART | ||
else | ||
echo "Ref does not match $RUN_FOR_REF, exiting." | ||
fi | ||
|
||
echo "##### end post-receive hook #####" |