43 lines
996 B
YAML
43 lines
996 B
YAML
name: CI/CD Pipeline
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build-and-test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v2
|
|
with:
|
|
node-version: '16'
|
|
|
|
- name: Install dependencies
|
|
run: npm install -g http-server
|
|
|
|
- name: Run tests
|
|
run: |
|
|
# Add test commands here
|
|
echo "Running tests..."
|
|
ls -la
|
|
|
|
- name: Build
|
|
run: |
|
|
# Any build steps if needed
|
|
echo "Build completed"
|
|
|
|
deploy:
|
|
needs: build-and-test
|
|
runs-on: self-hosted
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Deploy to server
|
|
run: |
|
|
# Copy files to web directory
|
|
sudo mkdir -p /var/www/html/tic-tac-toe
|
|
sudo cp -r ./index.html ./styles.css ./script.js ./PROJECT_PLAN.md ./README.md ./DEPLOYMENT.md ./DOCKER_DEPLOY.md /var/www/html/tic-tac-toe/
|
|
echo "Deployment completed" |