Skip to content

Commit a909c07

Browse files
committed
chore: improve deploy script
1 parent 8fc8985 commit a909c07

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

admin/userguide/.github/scripts/deploy renamed to admin/userguide/.github/scripts/deploy.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@
55
# codeigniter4/userguide repo's master branch.
66
# See https://github.com/codeigniter4/userguide/blob/master/.github/workflows/deploy.yml
77

8-
REPO=/opt/userguide
9-
SITE=/home/public_html/userguides/userguide4
8+
REPO="/opt/userguide"
9+
SITE="/home/public_html/userguides/userguide4"
10+
11+
if [ "$(id -u)" = "0" ]; then
12+
echo "Cannot be run as root. Please run as the user for deployment."
13+
exit 1
14+
fi
1015

1116
cd "$REPO"
1217
git switch master

admin/userguide/.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name: Deploy Production
44

55
on:
66
push:
7-
branches:
7+
branches:
88
- master
99

1010
jobs:
@@ -19,4 +19,4 @@ jobs:
1919
username: ${{ secrets.USERNAME }}
2020
key: ${{ secrets.KEY }}
2121
port: ${{ secrets.PORT }}
22-
script: /opt/userguide/.github/scripts/deploy
22+
script: /opt/userguide/.github/scripts/deploy.sh

0 commit comments

Comments
 (0)