Skip to content

Commit

Permalink
Update ci_cd.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
danyama committed Oct 3, 2024
1 parent 40f955e commit 5b9e8a9
Showing 1 changed file with 29 additions and 7 deletions.
36 changes: 29 additions & 7 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,39 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Check Alembic Migration Version
id: alembicChecker
uses: DevGlitch/[email protected]
with:
db_url: ${{ secrets.DB_URL }}
migrations_path: ./migrations/
# - name: Check Alembic Migration Version
# id: alembicChecker
# uses: DevGlitch/[email protected]
# with:
# db_url: ${{ secrets.DB_URL }}
# migrations_path: ./migrations/

- name: executing remote ssh commands using password
if: steps.alembicChecker.outputs == 0
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
password: ${{ secrets.SSH_PASSCODE }}
port: ${{ secrets.SSH_PORT }}
script: |
cd /diskb/home/backend
git pull origin develop
. /diskb/home/backend/.venv/bin/activate
alembic heads > heads_output.txt
alembic current > current_output.txt
if cmp -s heads_output.txt current_output.txt; then
echo "No new migrations to apply."
echo "new_migrations=false" >> $GITHUB_ENV
else
echo "New migrations found."
echo "new_migrations=true" >> $GITHUB_ENV
fi
- name: executing remote ssh commands using password
if:
uses: appleboy/[email protected]
with: env.new_migrations == 'true'
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
password: ${{ secrets.SSH_PASSCODE }}
Expand Down

0 comments on commit 5b9e8a9

Please sign in to comment.