cd ~/.ssh
ssh-keygen -t ecdsa -b 521
key starts withid_
ssh-copy-id username@ip
- setup github action secrets.
cat id_*
then copy the private key - copy the build.yml to your
/.github/workflows
folder
Last active
May 24, 2025 06:34
-
-
Save ericamigo/679dd743e11b08c550fcd84acf4c2eaf to your computer and use it in GitHub Desktop.
setup github actions
This file contains hidden or 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 Laravel Application to Production Server | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.4 | |
- name: Install Composer Dependencies | |
run: composer install --optimize-autoloader --no-dev --no-progress --no-interaction --prefer-dist | |
- name: Install Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
- name: Install NPM Dependencies | |
run: npm install | |
- name: Build NPM Assets | |
env: | |
VITE_PUSHER_APP_KEY: ${{ secrets.VITE_PUSHER_APP_KEY }} | |
VITE_PUSHER_PORT: ${{ secrets.VITE_PUSHER_PORT }} | |
VITE_PUSHER_SCHEME: ${{ secrets.VITE_PUSHER_SCHEME }} | |
VITE_PUSHER_APP_CLUSTER: ${{ secrets.VITE_PUSHER_APP_CLUSTER }} | |
run: npm run build | |
- name: Synchronize Files To Production | |
uses: easingthemes/ssh-deploy@main | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
SOURCE: '.' | |
REMOTE_HOST: ${{ secrets.VPS_HOST }} | |
REMOTE_USER: ${{ secrets.VPS_USER }} | |
TARGET: '/var/www/project-folder' | |
- name: Run Remote/Artisan Commands | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.VPS_HOST }} | |
username: ${{ secrets.VPS_USER }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
script: | | |
cd /var/www/project-folder | |
php artisan migrate --force | |
php artisan db:seed --class=MenuItemSeeder --force | |
php artisan cache:clear | |
php artisan optimize |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment