Skip to content

Commit

Permalink
Fix deploy script (#1004)
Browse files Browse the repository at this point in the history
  • Loading branch information
ije authored Jan 13, 2025
1 parent 552eb0a commit 35cc465
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
node-version: 20

- name: Build CLI
run: go build -ldflags="-s -w -X 'github.com/esm-dev/esm.sh/server.VERSION=${github.ref_name}'" -o cli/tmp/bin/esm.sh${{ matrix.ext }} cli/cmd/main.go
run: go build -ldflags="-s -w -X 'github.com/esm-dev/esm.sh/server.VERSION=${{ github.ref_name }}'" -o cli/tmp/bin/esm.sh${{ matrix.ext }} cli/cmd/main.go
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
Expand Down
8 changes: 4 additions & 4 deletions scripts/deploy-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ echo "--- installing server..."
ssh esm.sh << EOF
git version
if [ "\$?" == "127" ]; then
apt update
apt install -y git
apt-get update
apt-get install -y git
fi
ufw version
Expand All @@ -43,7 +43,7 @@ ssh esm.sh << EOF
reload=no
if [ ! -f \$servicefile ]; then
addgroup esm
adduser --ingroup esm --no-create-home --disabled-login --disabled-password --gecos "" esm
adduser --ingroup esm --home /esm --disabled-login --disabled-password --gecos "" esm
if [ "\$?" != "0" ]; then
echo "Failed to add user 'esm'"
exit 1
Expand Down Expand Up @@ -73,7 +73,7 @@ ssh esm.sh << EOF
rm -f \$configfile
if [ "$SERVER_CONFIG" != "" ]; then
echo "${SERVER_CONFIG}" >> \$configfile
echo '${SERVER_CONFIG}' >> \$configfile
else
echo "{}" >> \$configfile
fi
Expand Down
15 changes: 7 additions & 8 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,19 @@ fi

echo "--- installing..."
ssh -p $sshPort ${user}@${host} << EOF
gv=\$(git version)
if [ "\$?" != "0" ]; then
apt update
apt install -y git
git version
if [ "\$?" == "127" ]; then
apt-get update
apt-get install -y git
fi
echo \$gv
if [ "$init" == "yes" ]; then
configfile=/etc/esmd/config.json
servicefile=/etc/systemd/system/esmd.service
if [ -f \$servicefile ]; then
rm -f servicefile
fi
addgroup esm
adduser --ingroup esm --no-create-home --disabled-login --disabled-password --gecos "" esm
adduser --ingroup esm --home=/esm --disabled-login --disabled-password --gecos "" esm
if [ "\$?" != "0" ]; then
echo "Failed to add user 'esm'"
exit 1
Expand All @@ -93,9 +91,10 @@ ssh -p $sshPort ${user}@${host} << EOF
echo "[Service]" >> \$servicefile
echo "Type=simple" >> \$servicefile
if [ "$config" != "" ]; then
configfile=/etc/esmd/config.json
mkdir -p /etc/esmd
rm -f \$configfile
echo "$config" >> \$configfile
echo '$config' >> \$configfile
echo "ExecStart=/usr/local/bin/esmd --config=\$configfile" >> \$servicefile
else
echo "ExecStart=/usr/local/bin/esmd" >> \$servicefile
Expand Down

0 comments on commit 35cc465

Please sign in to comment.