-
Notifications
You must be signed in to change notification settings - Fork 4
47 lines (37 loc) · 1.22 KB
/
deploy.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
name: Deploy to Production
on:
push:
branches:
- main # Ganti dengan branch yang ingin Anda gunakan
pull_request:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up SSH
uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} # Tambahkan kunci SSH ke Secrets di GitHub
- name: Add Host Key to known_hosts
run: |
mkdir -p ~/.ssh
ssh-keyscan -H 8.219.65.111 >> ~/.ssh/known_hosts
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
- name: Install Composer Dependencies
run: composer install --optimize-autoloader --no-dev --no-progress --no-interaction --prefer-dist
- name: Run Envoy Deployment
run: |
composer global require laravel/envoy
~/.composer/vendor/bin/envoy run deploy --commit="${{ github.sha }}"
- name: Rollback if Deployment Fails
if: failure()
run: |
echo "Deployment failed. Rolling back to previous version."
~/.composer/vendor/bin/envoy run rollback