-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (51 loc) · 1.89 KB
/
deploy.server.workflow.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Deploy Server
on:
workflow_dispatch:
inputs:
version:
description: "Run number to deploy"
required: true
default: "latest"
type: string
environment:
description: "Environment to deploy to"
required: true
type: choice
default: "production"
options:
- "production"
- "test"
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Extract branch name
shell: bash
run: |
branch_name="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
branch_name=$(echo "$branch_name" | sed 's/\//_/g')
echo "branch=${branch_name}" >> $GITHUB_OUTPUT
id: extract_branch
- uses: actions/checkout@v4
- name: Deploy to server
uses: easingthemes/ssh-deploy@main
with:
SSH_PRIVATE_KEY: ${{ secrets.BLUMY_KEY }}
ARGS: "-rlgoDzvc -i"
SOURCE: "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 ${{ steps.extract_branch.outputs.branch }}"
export IMAGE_BRANCH=${{ steps.extract_branch.outputs.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"