- add extra jobs #28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
build: | |
name: Build binary file | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.2' | |
- name: Build binary | |
run: | | |
make build-prod | |
env: | |
APP_ENV: ${{ secrets.APP_ENV }} | |
APP_SECRET: ${{ secrets.APP_SECRET }} | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
copy: | |
name: Copy binary to server | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: copy file via ssh password | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
port: ${{ secrets.PORT }} | |
key: ${{ secrets.KEY }} | |
source: "/tmp/app" | |
target: /root/download | |
deploy: | |
name: Deploy on production | |
needs: copy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy commands | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.KEY }} | |
port: ${{ secrets.PORT }} | |
script: | | |
/root/scripts/deploy.sh |