Skip to content

Instantly share code, notes, and snippets.

@Yunnie-pin
Created June 23, 2023 11:34
Show Gist options
  • Save Yunnie-pin/da536ed5ecbe98d12fdff2cbe6049e41 to your computer and use it in GitHub Desktop.
Save Yunnie-pin/da536ed5ecbe98d12fdff2cbe6049e41 to your computer and use it in GitHub Desktop.
contoh konfigurasi ci/cd GitHub action untuk deploy aplikasi Laravel menggunakan Laravel envoy

guide

  1. create new folder .github/workflows in laravel app root dir
  2. create new file deploy.yml in workflows folder
  3. open repo settings secrets menu
  4. add new secret SSH_PRIVATE_KEY
  5. add new secret SSH_HOST
  6. add deploy keys with your ssh pubkey (optional)
  7. add this configuration template in deploy.yml file:
name: deploy

on: 
  push:
    branches: [test]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
            php-version: 8.0
            tools: composer:v2
            coverage: none
      - name: Install Composer dependencies
        run: composer update
      - name: Setup SSH
        uses: kielabokkie/ssh-key-and-known-hosts-action@v1.2.0
        with:
          ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
          ssh-host: ${{ secrets.SSH_HOST }}
      - name: Deploy Environment
        run: ./vendor/bin/envoy run deploy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment