From 8497ec6b3b97b29055fb74d62d07ad07d91bcc21 Mon Sep 17 00:00:00 2001 From: Robinson Uchechukwu Date: Thu, 15 Aug 2024 23:08:35 +0100 Subject: [PATCH] Update dev.yml --- .github/workflows/dev.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 6cf73839..25e73286 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -10,7 +10,7 @@ jobs: runs-on: bp-runner defaults: run: - working-directory: /var/www/aihomework/boilerplate + working-directory: /var/www/aihomework/boilerplate/dev steps: - name: Checkout code @@ -28,22 +28,22 @@ jobs: 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: 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 clone $remote_repo staging + git remote add action $remote_repo + git pull $remote_repo dev - name: Install dependencies run: yarn install --frozen-lockfile @@ -62,15 +62,15 @@ jobs: - name: Setup and restart service run: | - sudo cp server-script/aihomeworkstaging.service /etc/systemd/system + sudo cp server-script/aihomeworkdev.service /etc/systemd/system sudo systemctl daemon-reload - sudo systemctl restart aihomeworkstaging.service + sudo systemctl restart aihomeworkdev.service - name: Verify deployment run: | echo "Waiting for service to start..." sleep 10 - if sudo systemctl is-active --quiet aihomeworkstaging.service; then + if sudo systemctl is-active --quiet aihomeworkdev.service; then echo "Deployment successful!" else echo "Deployment failed!"