Skip to content

Merge pull request #622 from masterchief-Dave/feat/api-get-status #288

Merge pull request #622 from masterchief-Dave/feat/api-get-status

Merge pull request #622 from masterchief-Dave/feat/api-get-status #288

Workflow file for this run

name: Deploy to Dev
on:
push:
branches:
- dev
jobs:
deploy:
runs-on: bp_runner
defaults:
run:
working-directory: /var/www/aihomework/boilerplate/dev
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Remove old actions remote URL
continue-on-error: true
run: |
git remote rm action
- name: Stash or remove local changes
run: |
if git diff --quiet; then
echo "No local changes to stash."
else
echo "Stashing local changes..."
git stash --include-untracked || echo "Failed to stash changes. Attempting to reset..."
git reset --hard || exit 1
fi
- name: Pull from GitHub
id: pull
run: |
remote_repo="https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git"
git remote add action $remote_repo
git pull $remote_repo dev
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Run tests
run: yarn test
- name: Build the application
run: yarn build && sudo rm -rf build
# - name: Generate migrations
# run: yarn migration:generate
# - name: Run migrations
# run: yarn migration:run
- name: Setup and restart service
run: |
sudo cp server-script/aihomeworkdev.service /etc/systemd/system
sudo systemctl daemon-reload
sudo systemctl restart aihomeworkdev.service
- name: Verify deployment
run: |
echo "Waiting for service to start..."
sleep 10
if sudo systemctl is-active --quiet aihomeworkdev.service; then
echo "Deployment successful!"
else
echo "Deployment failed!"
exit 1
fi