Deploy to development #21
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 to development | |
| on: workflow_dispatch | |
| jobs: | |
| deploy-dev: | |
| runs-on: self-hosted # Ensure you're using your self-hosted runner | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 # Checkout the latest code | |
| # Optionally, set environment variables (if needed) | |
| - name: Set up environment variables | |
| uses: falti/dotenv-action@v1.1.4 | |
| with: | |
| export-variables: true | |
| keys-case: bypass | |
| - name: Check environment variables | |
| run: env | |
| # Remove existing docker containers | |
| - name: Stop and remove existing containers | |
| run: | | |
| sudo docker compose down || true | |
| # Pull the latest Docker images | |
| - name: Pull latest Docker images | |
| run: sudo docker compose pull || true | |
| # Build Docker images if there are any changes | |
| - name: Build Docker images | |
| run: sudo docker compose build --no-cache | |
| # Start Docker containers (detached mode) | |
| - name: Start Docker containers | |
| run: sudo docker compose up -d | |
| # Verify that the containers are running | |
| - name: Verify running Docker containers | |
| run: sudo docker ps -a |