-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
29 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 }} | ||
|