name: 🚀 Deploy on: workflow_dispatch: inputs: target_environment: description: "Deployment Environment" required: true default: "staging" type: choice options: - prod - staging target_host: description: "Deployment Host" required: true default: "staging" type: choice options: - eu - us - staging target_subdomain: description: "Deployment Subdomain" required: false default: "" type: string push: branches: - main jobs: deploy: # Use different logic based on event type name: Deploy to ${{ github.event_name == 'workflow_dispatch' && inputs.target_environment || 'staging' }} runs-on: ubuntu-latest environment: ${{ github.event_name == 'workflow_dispatch' && inputs.target_environment || 'staging' }} steps: - uses: actions/checkout@v4 - name: Log in to Docker Hub uses: docker/login-action@v3 with: username: ${{ vars.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - run: | mkdir -p ~/.ssh echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa ssh-keyscan -H ${{ secrets.SERVER_HOST_STAGING }} >> ~/.ssh/known_hosts # Determine environment based on trigger type TARGET_ENV="${{ github.event_name == 'workflow_dispatch' && inputs.target_environment || 'staging' }}" TARGET_HOST="${{ github.event_name == 'workflow_dispatch' && inputs.target_host || 'staging' }}" TARGET_SUBDOMAIN="${{ github.event_name == 'workflow_dispatch' && inputs.target_subdomain || 'main' }}" cat >.env.$TARGET_ENV <