Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Build and Deploy to Railway

on:
push:
branches: [ main ]

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json

- name: Install frontend dependencies
run: |
cd frontend
npm ci

- name: Build frontend
run: |
cd frontend
npm run build

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: mbstring, xml, ctype, iconv, intl, pdo_mysql
coverage: none

- name: Install backend dependencies
run: |
cd backend
composer install --no-dev --no-interaction --optimize-autoloader

- name: Run Laravel optimizations
run: |
cd backend
php artisan config:cache
php artisan route:cache
php artisan view:cache

- name: Run tests (if any)
run: |
cd backend
php artisan test --no-interaction
continue-on-error: true

deploy:
runs-on: ubuntu-latest
needs: build-and-test
if: github.ref == 'refs/heads/main'

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Railway CLI
run: npm i -g @railway/cli

- name: Authenticate with Railway
run: railway login --token ${{ secrets.RAILWAY_TOKEN }}

- name: Deploy to Railway
run: railway up --service service-name --environment production
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
config.bat
node_modules
Loading