-
Notifications
You must be signed in to change notification settings - Fork 1
50 lines (41 loc) · 1.47 KB
/
python-app.yml
File metadata and controls
50 lines (41 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
env:
SSH_PRIVATE_KEY: ${{ secrets.CIPIEPLINE }}
USERNAME: ${{ secrets.USER_NAME }}
HOST: ${{ secrets.HOST_NAME}}
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Deploy to server
run: echo "$SSH_PRIVATE_KEY" > private_key.pem
- run: chmod 600 private_key.pem
- run: |
ssh -i private_key.pem -o StrictHostKeyChecking=no $USERNAME@$HOST <<EOF
mkdir -p /home/$USERNAME/app
pkill -f "python3 madlibs.py" || true
mkdir -p /home/$USERNAME/proof
EOF
- run: scp -i private_key.pem -o StrictHostKeyChecking=no -r ./* $USERNAME@$HOST:/home/$USERNAME/app
- run: |
ssh -i private_key.pem -o StrictHostKeyChecking=no $USERNAME@$HOST <<EOF
cd /home/$USERNAME/app
sudo apt install python3-pip
wget https://bootstrap.pypa.io/get-pip.py | sudo python
wget https://bootstrap.pypa.io/get-pip.py | sudo python3
python3 -m pip install flask
nohup python3 madlibs.py >> app.log 2>&1 &
disown
EOF