diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 000000000..9d728db48 --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,27 @@ +name: Deploy to VM + +on: + push: + branches: + - master + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up SSH + uses: webfactory/ssh-agent@v0.5.4 + with: + ssh-private-key: ${{ secrets.VM_KEY }} + + - name: Deploy to VM + run: | + ssh Aarish@172.172.151.63 << 'EOF' + cd /home/Aarish/flask-hello-world + git pull origin master + sudo systemctl restart flaskapp + EOF diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..81dc1861a --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,27 @@ +name: Deploy to VM + +on: + push: + branches: + - master + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up SSH + uses: webfactory/ssh-agent@v0.5.3 + with: + ssh-private-key: ${{ secrets.VM_KEY }} + + - name: Deploy to VM + run: | + ssh StrictHostKeyChecking=no Aarish@172.172.151.63 << 'EOF' + cd /home/Aarish/flask-hello-world + git pull origin master + sudo systemctl restart flaskapp + EOF diff --git a/app.py b/app.py index d82c51f0d..afa301d25 100644 --- a/app.py +++ b/app.py @@ -3,4 +3,6 @@ @app.route('/') def hello_world(): - return 'Hello, World!' + return 'Hello, World! This is Aarish Thanks ' +if __name__ == "__main__": + app.run()