-
Notifications
You must be signed in to change notification settings - Fork 2
49 lines (42 loc) · 1.3 KB
/
cd.yml
File metadata and controls
49 lines (42 loc) · 1.3 KB
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
# 추후 프로젝트 ci/cd규모 커지면 cd.yml로 배포 워크플로우 분리
name: CD - Deploy Backend
on:
workflow_run:
workflows: ["CI - Build & Push Backend"]
types: [completed]
branches: [release]
workflow_dispatch:
inputs:
tag:
description: "Deploy image tag (default: release)"
required: false
default: "release"
permissions:
contents: read
concurrency:
group: deploy-docsa
cancel-in-progress: false
jobs:
deploy:
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
environment: production
steps:
- name: Decide tag
id: tag
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "value=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
else
echo "value=release" >> $GITHUB_OUTPUT
fi
- name: Deploy via SSH
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.CD_HOST }}
username: ${{ secrets.CD_USER }}
key: ${{ secrets.CD_SSH_KEY }}
port: ${{ secrets.CD_PORT }}
script: |
export DEPLOY_TAG='${{ steps.tag.outputs.value }}'
bash -lc '/srv/docsa/infra/deploy.sh'