Skip to content

Commit 83ed70b

Browse files
committed
test
1 parent 50e401c commit 83ed70b

File tree

2 files changed

+48
-45
lines changed

2 files changed

+48
-45
lines changed

.github/workflows/ci.yml

Lines changed: 47 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -119,50 +119,55 @@ jobs:
119119
echo "Contents of client/dist:"
120120
ls -la client/dist
121121
122-
# Deploy to Heroku
123-
- name: Deploy to Heroku
124-
if: github.ref == 'refs/heads/main' && success()
125-
env:
126-
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
127-
run: |
128-
# Enable error logging
129-
set -x
130-
131-
# Ensure the public directory exists and copy files
132-
mkdir -p server/public
133-
cp -r client/dist/* server/public/
134-
135-
# Configure Git
136-
git config --global user.email "[email protected]"
137-
git config --global user.name "CI/CD Pipeline"
138-
139-
# Stage and commit the built files
140-
git add server/public -f
141-
git commit -m "Update frontend build [skip ci]" || echo "No changes to commit"
142-
143-
# Install Heroku CLI if not already installed
144-
if ! command -v heroku &> /dev/null; then
122+
- name: Deploy to Heroku
123+
if: github.ref == 'refs/heads/main' && success()
124+
env:
125+
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
126+
run: |
127+
# Enable error logging
128+
set -x
129+
130+
# Create necessary directories
131+
mkdir -p server/public
132+
133+
# Copy built frontend files
134+
cp -r client/dist/* server/public/
135+
136+
# Create Procfile if it doesn't exist
137+
echo "web: node server.js" > server/Procfile
138+
139+
# Configure Git
140+
git config --global user.email "[email protected]"
141+
git config --global user.name "CI/CD Pipeline"
142+
143+
# Install Heroku CLI
145144
curl https://cli-assets.heroku.com/install.sh | sh
146-
fi
147-
148-
# Add Heroku remote
149-
heroku git:remote -a gymero
150-
151-
# Push to Heroku
152-
git push https://heroku:${{ secrets.HEROKU_API_KEY }}@git.heroku.com/gymero.git HEAD:main --force
153-
154-
# If deployment fails, show Heroku logs
155-
if [ $? -ne 0 ]; then
156-
heroku logs --tail --app gymero
157-
exit 1
145+
146+
# Add Heroku remote
147+
heroku git:remote -a gymero
148+
149+
# Stage all changes
150+
git add -f server/public/* server/Procfile
151+
git commit -m "Deploy: Include frontend build and Procfile" || echo "No changes to commit"
152+
153+
# Push to Heroku
154+
git push https://heroku:${{ secrets.HEROKU_API_KEY }}@git.heroku.com/gymero.git HEAD:main --force
155+
156+
# Wait for deployment to complete
157+
sleep 5
158+
159+
# Check deployment status
160+
if ! curl -s https://gymero.live > /dev/null; then
161+
echo "Deployment verification failed"
162+
heroku logs --tail --app gymero
163+
exit 1
164+
fi
158165
159-
# Post-deployment verification
160-
- name: Verify deployment
161-
if: github.ref == 'refs/heads/main' && success()
162-
run: |
163-
echo "Waiting for deployment to stabilize..."
164-
sleep 30
165-
curl --fail https://gymero.live || exit 1
166+
- name: Verify deployment
167+
if: success()
168+
run: |
169+
echo "Deployment completed successfully"
170+
curl -I https://gymero.live
166171
167172
# Debug MySQL logs if needed
168173
- name: MySQL Logs

server/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
"scripts": {
88
"start": "node server.js",
99
"dev": "nodemon server.js",
10-
"test": "echo \"No tests specified\"",
11-
"build": "cd ../client && npm install && npm run build && cp -r dist/* ../server/public/",
12-
"heroku-postbuild": "cd ../client && npm install && npm run build && cp -r dist/* ../server/public/"
10+
"test": "echo \"No tests specified\""
1311
},
1412
"keywords": [],
1513
"author": "",

0 commit comments

Comments
 (0)