-
Notifications
You must be signed in to change notification settings - Fork 16
51 lines (44 loc) · 1.54 KB
/
Copy pathdeploy_dev.yml
File metadata and controls
51 lines (44 loc) · 1.54 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
50
51
name: Deploy OpenKab Dev with Ansible
on:
pull_request:
branches: [rilis-dev]
types: [closed]
workflow_dispatch:
inputs:
info:
description: '⚠️ Branch rilis-dev only. Tidak perlu diisi, cukup pilih branch lalu klik Run workflow.'
required: false
type: string
permissions:
contents: read
concurrency:
group: deploy-openkab-dev
cancel-in-progress: true
jobs:
deploy:
if: |
(github.event_name == 'pull_request' && github.event.pull_request.merged == true) ||
github.event_name == 'workflow_dispatch'
name: Deploy OpenKab Dev to Production Server
runs-on: ubuntu-latest
steps:
- name: Ensure workflow_dispatch uses rilis-dev
if: github.event_name == 'workflow_dispatch'
run: |
if [ "${GITHUB_REF_NAME}" != "rilis-dev" ]; then
echo "::error::workflow_dispatch hanya boleh dijalankan dari branch rilis-dev. Saat ini: ${GITHUB_REF_NAME}"
exit 1
fi
- name: Checkout Ansible Code
uses: actions/checkout@v4
- name: Deploy via SSH using appleboy/ssh-action
uses: appleboy/ssh-action@v1.2.0
with:
host: ${{ secrets.CICD_SERVER_IP }}
username: ${{ secrets.CICD_SERVER_USER }}
key: ${{ secrets.CICD_SERVER_PRIVATE_KEY }}
port: ${{ secrets.CICD_SERVER_PORT }}
script: |
set -euo pipefail
cd ${{ secrets.CICD_SERVER_PATH }}
ansible-playbook -i inventories/production/inventory.yml playbooks/deploy-openkab-dev.yml