Deploy Blumy-Server #5
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 Blumy-Server | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Run number to deploy" | |
required: true | |
default: "latest" | |
type: string | |
branch: | |
description: "Branch to deploy" | |
required: true | |
default: "main" | |
type: string | |
environment: | |
description: "Environment to deploy to" | |
required: true | |
type: choice | |
default: "production" | |
options: | |
- "production" | |
- "test" | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Deploy to server | |
uses: easingthemes/ssh-deploy@main | |
with: | |
SSH_PRIVATE_KEY: ${{ secrets.BLUMY_KEY }} | |
ARGS: "-rlgoDzvc -i" | |
SOURCE: "Blumy-Server/docker-compose.yml" | |
REMOTE_HOST: ${{ secrets.BLUMY_HOST }} | |
REMOTE_USER: ${{ secrets.BLUMY_USER }} | |
TARGET: ${{ github.event.inputs.environment == 'production' && secrets.BLUMY_HOST_PATH || secrets.BLUMY_TEST_HOST_PATH }}/ | |
SCRIPT_BEFORE: | | |
echo "Nothing to do before deploy" | |
SCRIPT_AFTER: | | |
echo "Deploying with Docker Compose" | |
cd ${{ github.event.inputs.environment == 'production' && secrets.BLUMY_HOST_PATH || secrets.BLUMY_TEST_HOST_PATH }} | |
echo "setting IMAGE_BRANCH to ${{ github.event.inputs.branch }}" | |
export IMAGE_BRANCH=${{ github.event.inputs.branch }} | |
echo "setting IMAGE_NUMBER to ${{ github.event.inputs.version }}" | |
export IMAGE_NUMBER=${{ github.event.inputs.version }} | |
echo "Running Docker Compose" | |
docker compose pull | |
docker compose up -d | |
echo "Deployment complete" |