Skip to content

Instantly share code, notes, and snippets.

@AnthoniG
Forked from thecodeholic/deploy.yml
Created July 30, 2025 20:14
Show Gist options
  • Save AnthoniG/097e860c694ee026d266a2a9dba0c224 to your computer and use it in GitHub Desktop.
Save AnthoniG/097e860c694ee026d266a2a9dba0c224 to your computer and use it in GitHub Desktop.
Github Actions Workflow
name: CloudaysDeploy
on:
push:
branches: [main]
# release:
# types: [created]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: Create .env
run: cp .env.example .env
- name: Install composer Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Set Application Encryption Key
run: php artisan key:generate --ansi
- name: Create Storage Link
run: php artisan storage:link
- name: Run Migrations
run: php artisan migrate --force
- name: Install node dependencies
run: npm ci
- name: Build Assets
run: npm run build
- name: Run Tests
run: php artisan test
- name: Deploy PHP to Server
if: ${{ success() }}
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
port: ${{ secrets.SSH_PORT }}
key: ${{ secrets.SSH_KEY }}
script_stop: true
script: |
cd applications/deploymentdemo/public_html
git fetch --all
git checkout main
git pull
composer install
npm ci
npm run build
php artisan migrate --force
php artisan config:cache
php artisan route:cache
php artisan view:cache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment