Feat: correct update of workflow files (hopefully) #31
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: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| deploy-dev: | |
| runs-on: self-hosted | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3.6.0 | |
| - name: Check Docker installation | |
| run: | | |
| if ! command -v docker &> /dev/null; then | |
| echo "Docker is not installed" | |
| exit 1 | |
| fi | |
| if ! docker info &> /dev/null; then | |
| echo "Docker daemon is not running" | |
| exit 1 | |
| fi | |
| - name: Set up environment variables | |
| uses: falti/dotenv-action@v1.1.4 | |
| with: | |
| export-variables: true | |
| keys-case: bypass | |
| - name: Check environment variables (should not really be here as you might expose secrets ) | |
| run: env | |
| # Remove existing docker containers | |
| - name: Stop and remove existing containers | |
| run: | | |
| docker compose down || true | |
| docker system prune -f || true | |
| # Pull the latest Docker images | |
| - name: Pull latest Docker images | |
| run: | | |
| docker compose pull || { | |
| echo "Failed to pull Docker images" | |
| exit 1 | |
| } | |
| # Build Docker images if there are any changes | |
| - name: Build Docker images | |
| run: | | |
| docker compose build --no-cache || { | |
| echo "Failed to build Docker images" | |
| exit 1 | |
| } | |
| # Start Docker containers (detached mode) | |
| - name: Start Docker containers | |
| run: docker compose up -d | |
| # Verify that the containers are running | |
| - name: Verify running Docker containers | |
| run: docker ps -a |