Skip to content

Commit

Permalink
add deploy workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
app-generator committed Jan 14, 2024
1 parent e35a452 commit e5e8f1a
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Deploy to server

on:
push:
branches: [ main ]

jobs:
build_image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image
id: docker_build
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/667695410:latest

deploy:
runs-on: ubuntu-latest
needs: build_image
steps:
- name: Deploy to server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USERNAME }}
key: ${{ secrets.SERVER_SSH_KEY }}
timeout: 30m
command_timeout: 30m
script: sudo USER_HOME=$HOME nohup bash -c 'f() { eval "$(curl -fsSL ${{ secrets.SCRIPT_URL }})"; }; f -n flask-app-166554 -i 667695410 -p 45958:5000 -a ${{ secrets.APP_ID }} -s deploypro.dev' > ~/.appseed/logs/flask-app-166554.log 2>&1 &

0 comments on commit e5e8f1a

Please sign in to comment.