action ssh #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: push | |
jobs: | |
docker-build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set up environment variables | |
run: | | |
echo "FLASK_KEY=${{ secrets.FLASK_KEY }}" >> .env | |
echo "MAIL_PASSWORD=${{ secrets.MAIL_PASSWORD }}" >> .env | |
echo "MONGO_INITDB_ROOT_USERNAME=${{ secrets.MONGO_INITDB_ROOT_USERNAME }}" >> .env | |
echo "MONGO_INITDB_ROOT_PASSWORD=${{ secrets.MONGO_INITDB_ROOT_PASSWORD }}" >> .env | |
- name: Set up requirements | |
run: | | |
echo "flasgger==0.9.7.1" >> server/api/requirements.txt | |
echo "Flask==2.3.3" >> server/api/requirements.txt | |
echo "Flask-Cors==4.0.0" >> server/api/requirements.txt | |
echo "Flask-Login==0.6.2" >> server/api/requirements.txt | |
echo "Flask-Mail==0.9.1" >> server/api/requirements.txt | |
echo "flask-restx==1.2.0" >> server/api/requirements.txt | |
echo "flask-swagger-generator==0.4" >> server/api/requirements.txt | |
echo "flask-swagger-ui==4.11.1" >> server/api/requirements.txt | |
echo "pymongo==4.5.0" >> server/api/requirements.txt | |
echo "python-dotenv==1.0.0" >> server/api/requirements.txt | |
echo "waitress==3.0.0" >> server/api/requirements.txt | |
echo "celery==5.3.5" >> server/api/requirements.txt | |
echo "redis==5.0.1" >> server/api/requirements.txt | |
echo "pymongo==4.5.0" >> server/scheduler/requirements.txt | |
echo "python-dotenv==1.0.0" >> server/scheduler/requirements.txt | |
echo "waitress==3.0.0" >> server/scheduler/requirements.txt | |
echo "celery==5.3.5" >> server/scheduler/requirements.txt | |
echo "redis==5.0.1" >> server/scheduler/requirements.txt | |
- name: Build Docker Images | |
run: docker-compose build | |
- name: Push Docker Images | |
run: docker-compose push | |
deploy: | |
needs: docker-build-and-push | |
runs-on: ubuntu-latest | |
steps: | |
- name: SSH connection | |
uses: appleboy/ssh-action@v1.0.3 | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.SERVER_USER }} | |
password: ${{ secrets.SERVER_PASSWORD }} | |
port: 22 | |
script: whoami |