name: 🚂 Railway Deployment on: push: branches: [main, develop] pull_request: branches: [main] workflow_dispatch: inputs: environment: description: 'Deployment environment' required: true default: 'production' type: choice options: [production, staging, preview] jobs: deploy: name: Deploy to Railway runs-on: ubuntu-latest environment: ${{ github.event.inputs.environment || 'production' }} steps: - name: 📥 Checkout uses: actions/checkout@v4 - name: 🔧 Setup Node uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' - name: 📦 Install Railway CLI run: npm install -g @railway/cli - name: 🏗️ Build run: | if [ -f package.json ]; then npm ci npm run build --if-present fi - name: 🚀 Deploy run: | railway link ${{ secrets.RAILWAY_PROJECT_ID }} railway up --service blackroad-private --environment ${{ github.event.inputs.environment || 'production' }} env: RAILWAY_TOKEN: ${{ secrets.RAILWAY_TOKEN }} - name: 📊 Summary run: | echo "### 🚂 Railway Deployment Success" >> $GITHUB_STEP_SUMMARY echo "- **Environment**: ${{ github.event.inputs.environment || 'production' }}" >> $GITHUB_STEP_SUMMARY echo "- **Branch**: ${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY