This repository was archived by the owner on Nov 18, 2024. It is now read-only.
Deploy to Virtual Machine #102
This file contains hidden or 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 to Virtual Machine | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| build-and-deploy: | |
| name: Build and Deploy | |
| runs-on: ubuntu-20.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Deploy to Virtual Machine | |
| uses: appleboy/[email protected] | |
| with: | |
| host: ${{ secrets.HOST }} | |
| username: ${{ secrets.USERNAME }} | |
| password: ${{ secrets.PASSWORD }} | |
| rm: true | |
| source: "*" | |
| target: "/home/sokungz/cpe241/backend" | |
| - name: Create environment file | |
| uses: appleboy/[email protected] | |
| with: | |
| host: ${{ secrets.HOST }} | |
| username: ${{ secrets.USERNAME }} | |
| password: ${{ secrets.PASSWORD }} | |
| script: | | |
| cd /home/sokungz/cpe241/backend | |
| docker compose down | |
| echo "${{ secrets.ENV }}" >> .env | |
| docker compose --env-file .env up -d --build |