-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.yml
More file actions
103 lines (88 loc) · 4.73 KB
/
deploy.yml
File metadata and controls
103 lines (88 loc) · 4.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# @file deploy.yml
# @description GitHub Actions workflow to automatically deploy the AirChat application
# to a hosting environment (e.g., Firebase Hosting, Vercel, Netlify) upon pushes to the main branch.
# This example provides a generic structure that you would adapt to your specific hosting provider.
name: Deploy AirChat App
on:
push:
branches:
- main # Trigger this workflow when changes are pushed to the 'main' branch
jobs:
build-and-deploy:
runs-on: ubuntu-latest # Use the latest Ubuntu runner
steps:
- name: Checkout code
uses: actions/checkout@v4 # Action to check out your repository code
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20' # Specify the Node.js version to use
- name: Install dependencies
run: |
npm install # Install backend dependencies
# If you have frontend build steps (e.g., React build), add them here:
# cd public && npm install && npm run build # Example for a React frontend inside public
- name: Run tests (optional)
run: |
# npm test # Uncomment if you have tests defined in package.json
echo "No tests configured for this project."
- name: Deploy to Hosting Provider (Generic Example)
# This step needs to be customized based on your actual hosting provider.
# Below are examples for common providers. Choose and uncomment the one you use.
# --- Example: Deploy to Firebase Hosting ---
# - name: Deploy to Firebase
# uses: FirebaseExtended/action-hosting-deploy@v0
# with:
# repoToken: '${{ secrets.GITHUB_TOKEN }}' # GitHub token for status updates
# firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_AIRCHAT }}' # Your Firebase service account JSON
# projectId: 'your-firebase-project-id' # Your Firebase project ID
# channelId: live # Or 'preview' for pull requests
# target: airchat-app # If you have multiple sites in one project
# --- Example: Deploy to Vercel ---
# - name: Deploy to Vercel
# run: |
# npm install -g vercel # Install Vercel CLI
# vercel pull --yes --token=${{ secrets.VERCEL_TOKEN }} # Pull Vercel project settings
# vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} # Build for production
# vercel deploy --prod --prebuilt --token=${{ secrets.VERCEL_TOKEN }} # Deploy pre-built project
# env:
# VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
# VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
# --- Example: Deploy to Netlify ---
# - name: Deploy to Netlify
# uses: nwtgck/actions-netlify@v2.0
# with:
# publish-dir: './public' # Directory to publish
# production-branch: 'main'
# netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
# deploy-message: "Deployed from GitHub Actions"
# env:
# NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
# --- Generic SCP/SSH Deployment (for custom servers) ---
- name: Deploy via SCP (Generic Example - Uncomment and configure for your server)
# This is a placeholder. You'll need to configure SSH keys and server details.
# Ensure you have SSH_PRIVATE_KEY and SSH_HOST, SSH_USERNAME, TARGET_DIR in your GitHub Secrets.
# uses: appleboy/scp-action@master
# with:
# host: ${{ secrets.SSH_HOST }}
# username: ${{ secrets.SSH_USERNAME }}
# key: ${{ secrets.SSH_PRIVATE_KEY }}
# source: ".,!node_modules" # Copy all files except node_modules
# target: ${{ secrets.TARGET_DIR }}
# rm: true # Remove existing files on target before copying
# After copying files, you might need to restart your Node.js server
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.SSH_HOST }}
# username: ${{ secrets.SSH_USERNAME }}
# key: ${{ secrets.SSH_PRIVATE_KEY }}
# script: |
# cd ${{ secrets.TARGET_DIR }}
# npm install --production # Install production dependencies on server
# pm2 restart airchat-app # Example using PM2 to restart your app
run: |
echo "Deployment step needs to be configured for your specific hosting provider."
echo "Please uncomment and configure one of the examples above (Firebase, Vercel, Netlify, or SCP/SSH)."
echo "Or add your custom deployment commands here."
- name: Deployment successful
run: echo "Deployment workflow completed. Check your hosting provider for status."