diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..698da0e --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,45 @@ +name: Deploy to Linode via SSH + +on: + push: + branches: + - main # Change to your main branch name + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + submodules: 'recursive' # Clone submodules + + - name: Update apt cache on the runner and install dependencies + run: sudo apt update && sudo apt install sshpass + + - name: Set up SSH + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + + - name: copy file via ssh password + uses: appleboy/scp-action@master + with: + host: ${{ secrets.LINODE_IP }} + username: ${{ secrets.USER }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + port: 22 + source: ./* + target: ${{ secrets.PATH_TO_SAVE }} + + - name: execute container + uses: appleboy/ssh-action@v1.0.0 + with: + host: ${{ secrets.LINODE_IP }} + username: ${{ secrets.USER }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + port: 22 + script: | + cd ${{ secrets.PATH_TO_SAVE }} + docker-compose pull && docker-compose up -d diff --git a/docker-compose.yml b/docker-compose.yml index c9a83e2..38c23f6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -38,5 +38,5 @@ volumes: driver: local # Define the driver and options under the volume name driver_opts: type: none - device: /data/db + device: /home/ferran/data/ o: bind diff --git a/refuapp-backend b/refuapp-backend index 1e4c8c9..017c50a 160000 --- a/refuapp-backend +++ b/refuapp-backend @@ -1 +1 @@ -Subproject commit 1e4c8c96fb51439ef833e6bc1b9b753b86c76999 +Subproject commit 017c50a5a9826af8859db7164c910ce20f330fe1