Created
July 30, 2025 16:26
-
-
Save thecodeholic/166301d93720499f3f0ede8fb4feb681 to your computer and use it in GitHub Desktop.
Github Actions Workflow
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: 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