Deploy all services to host #35
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 all services to host | |
on: | |
workflow_dispatch: | |
inputs: | |
service: | |
description: 'Service to deploy' | |
required: true | |
default: 'all' | |
type: choice | |
options: | |
- all | |
- backend | |
- frontend | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
deploy: | |
name: Deploy to Host | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: read | |
steps: | |
- name: Pull new images on host and restart containers | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
key: ${{ secrets.SSH_KEY }} | |
script: | | |
docker login ${{ env.REGISTRY }} -u ${{ github.actor }} -p ${{ github.token }} | |
docker compose pull | |
docker compose up -d ${{ inputs.service != 'all' && inputs.service || '' }} | |
docker logout ${{ env.REGISTRY }} |