Skip to content

Add debug info to deploy workflow #45

Add debug info to deploy workflow

Add debug info to deploy workflow #45

Workflow file for this run

name: Deploy Docker Image

Check failure on line 1 in .github/workflows/deploy-docker.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/deploy-docker.yml

Invalid workflow file

Invalid type for `job.environment`
on:
workflow_run:
workflows: ["Build and Push"]
branches:
- main
- develop
types:
- completed
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: ${{ (github.ref == 'refs/heads/main') && 'PROMPT-Prod' || (github.ref == 'refs/heads/develop') && 'PROMPT-Dev' }}
url: 'https://${{ vars.VM_HOST }}'
steps:
- name: Print debug information
run: |
echo "GitHub Ref: ${{ github.ref }}"
echo "Current Environment Selector: ${{ (github.ref == 'refs/heads/main') && 'PROMPT-Prod' || (github.ref == 'refs/heads/develop') && 'PROMPT-Dev' }}"
echo "Simplified Environment Selector: ${{ (github.ref == 'refs/heads/main') && 'PROMPT-Prod' || 'PROMPT-Dev' }}"
echo "Choose Environment: ${{ env.name }}"
echo "VM Host: ${{ vars.VM_HOST }}"
- name: SSH to VM and Execute Docker-Compose Down
uses: appleboy/ssh-action@v1.0.3
continue-on-error: true
with:
host: ${{ vars.VM_HOST }}
username: ${{ vars.VM_USERNAME }}
key: ${{ secrets.VM_SSH_PRIVATE_KEY }}
proxy_host: ${{ vars.DEPLOYMENT_GATEWAY_HOST }}
proxy_username: ${{ vars.DEPLOYMENT_GATEWAY_USER }}
proxy_key: ${{ secrets.DEPLOYMENT_GATEWAY_SSH_KEY }}
proxy_port: ${{ vars.DEPLOYMENT_GATEWAY_PORT }}
script: |
docker compose -f tease/docker-compose.prod.yml --env-file=.env.prod down --remove-orphans --rmi all
- name: checkout
uses: actions/checkout@v4
- name: Copy Docker Compose File From Repo to VM Host
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ vars.VM_HOST }}
username: ${{ vars.VM_USERNAME }}
key: ${{ secrets.VM_SSH_PRIVATE_KEY }}
proxy_host: ${{ vars.DEPLOYMENT_GATEWAY_HOST }}
proxy_username: ${{ vars.DEPLOYMENT_GATEWAY_USER }}
proxy_key: ${{ secrets.DEPLOYMENT_GATEWAY_SSH_KEY }}
proxy_port: ${{ vars.DEPLOYMENT_GATEWAY_PORT }}
source: "./docker-compose.prod.yml"
target: /home/${{ vars.VM_USERNAME }}/tease
- name: SSH to VM and Execute Docker-Compose Up
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ vars.VM_HOST }}
username: ${{ vars.VM_USERNAME }}
key: ${{ secrets.VM_SSH_PRIVATE_KEY }}
proxy_host: ${{ vars.DEPLOYMENT_GATEWAY_HOST }}
proxy_username: ${{ vars.DEPLOYMENT_GATEWAY_USER }}
proxy_key: ${{ secrets.DEPLOYMENT_GATEWAY_SSH_KEY }}
proxy_port: ${{ vars.DEPLOYMENT_GATEWAY_PORT }}
script: |
docker compose -f tease/docker-compose.prod.yml --env-file=.env.prod up --pull=always -d