Skip to content

Commit 3c8733e

Browse files
authored
Merge pull request #54 from cs01/cs01/auto-deploy
auto-deploy latest changes with github action
2 parents 5a8eadc + 5ebad60 commit 3c8733e

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Deploy latest to server
2+
on:
3+
push:
4+
branches: [main]
5+
6+
jobs:
7+
deploy:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Deploy NodeJS app
11+
uses: appleboy/[email protected]
12+
with:
13+
host: ${{secrets.SSH_HOST}} # IP address of the server you wish to ssh into
14+
key: ${{secrets.SSH_KEY}} # Private or public key of the server
15+
username: ${{ secrets.SSH_USERNAME }} # User of the server you want to ssh into
16+
17+
script: |
18+
set -e
19+
20+
mkdir -p $HOME/webapps
21+
git clone https://github.com/cs01/python-packaging-tools $HOME/webapps/python-packaging-tools || true
22+
cd $HOME/webapps/python-packaging-tools
23+
git reset --hard
24+
cd frontend
25+
yarn
26+
yarn build
27+
28+
# reload and restart systemd service
29+
sudo cp scripts/python-packaging-tools.service /etc/systemd/system/python-packaging-tools.service
30+
sudo systemctl daemon-reload
31+
sudo systemctl enable python-packaging-tools.service
32+
sudo systemctl restart python-packaging-tools

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.env
22
data.json
33
makefile
4-
*.service
54
node_modules
65
frontend/src/App.css
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# https://www.freedesktop.org/software/systemd/man/systemd.service.html
2+
[Unit]
3+
Description=
4+
After=network.target
5+
6+
[Service]
7+
User=csmith
8+
Group=www-data
9+
WorkingDirectory=$HOME/webapps/python-packaging-tools/backend
10+
PermissionsStartOnly=true
11+
ExecStart=/bin/bash $HOME/webapps/python-packaging-tools/backend/start.sh
12+
ExecStop=
13+
Restart=on-failure
14+
RestartSec=5s
15+
16+
[Install]
17+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)