From d061a06f5a92e2b8489399c76e294ae11fca6475 Mon Sep 17 00:00:00 2001 From: Michael Brusegard <56915010+michaelbrusegard@users.noreply.github.com> Date: Thu, 7 Mar 2024 15:26:36 +0100 Subject: [PATCH 1/3] fix: update the workflows --- .github/workflows/deploy.yml | 41 +++++++++++++-------------- .github/workflows/integration.yml | 46 ++++++++++++++++--------------- requirements.txt | 4 +-- 3 files changed, 45 insertions(+), 46 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 68d89cc9e..c3ed83567 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,9 +1,7 @@ name: Deploy to Server on: - pull_request: - # Change to merge when implemented (still beta) - types: [closed] + push: branches: - master @@ -12,22 +10,21 @@ jobs: name: Deploy runs-on: ubuntu-latest steps: - - name: executing remote ssh commands using key - uses: appleboy/ssh-action@v0.1.4 - if: github.event.pull_request.merged == true - with: - host: ${{ secrets.host }} - username: ${{ secrets.user }} - key: ${{ secrets.id }} - port: ${{ secrets.port }} - script: | - cd ${{ secrets.deploy_dir }} - . venv-prod/bin/activate - cd website - git pull - python -m pip install --upgrade pip - pip install --upgrade --force-reinstall -r prod_requirements.txt - python manage.py migrate - python manage.py collectstatic --noinput - python manage.py compilemessages - echo "${{ secrets.dingseboms_password }}" | sudo -S systemctl restart gunicorn + - name: executing remote ssh commands using key + uses: appleboy/ssh-action@v0.1.4 + with: + host: ${{ secrets.host }} + username: ${{ secrets.user }} + key: ${{ secrets.id }} + port: ${{ secrets.port }} + script: | + cd ${{ secrets.deploy_dir }} + . venv-prod/bin/activate + cd website + git pull + python -m pip install --upgrade pip + pip install --upgrade --force-reinstall -r prod_requirements.txt + python manage.py migrate + python manage.py collectstatic --noinput + python manage.py compilemessages + echo "${{ secrets.dingseboms_password }}" | sudo -S systemctl restart gunicorn diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 92ca91d3a..476ec19c3 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -5,31 +5,33 @@ on: branches: - master pull_request: + branches: + - master jobs: build: - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Set up Python 3.8 - uses: actions/setup-python@v1 - with: - python-version: 3.8 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install --upgrade --force-reinstall -r prod_requirements.txt - - name: Initialize Django - # Stop the build if migrations are not committed to repo. If action stops here, - # run `pt manage.py makemigrations` and commit the generated files. - run: | - python manage.py makemigrations --check - python manage.py migrate - - name: Run pre-commit hooks - run: | - pre-commit run --all-files - - name: Run Django tests - run: | - python manage.py test + - uses: actions/checkout@v4 + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: 3.10 + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install --upgrade --force-reinstall -r prod_requirements.txt + - name: + Initialize Django + # Stop the build if migrations are not committed to repo. If action stops here, + # run `pt manage.py makemigrations` and commit the generated files. + run: | + python manage.py makemigrations --check + python manage.py migrate + - name: Run pre-commit hooks + run: | + pre-commit run --all-files + - name: Run Django tests + run: | + python manage.py test diff --git a/requirements.txt b/requirements.txt index abfe58555..d5b52c655 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ pre-commit==2.15.0 -Django==3.2.20 +Django==3.2.24 django-ckeditor==6.2.0 coverage==6.3.2 sorl-thumbnail==12.8.0 @@ -7,7 +7,7 @@ python-coveralls==2.9.3 djangorestframework==3.13.1 django-filter==21.1 Markdown==3.3.6 -Pillow==9.3.0 +Pillow==9.5.0 python-dataporten-auth==2.0.0 social-auth-app-django==5.0.0 rapidfuzz==1.8.2 From 687a21b4f16befdfe68d4c727815281b6bf978d3 Mon Sep 17 00:00:00 2001 From: Michael Brusegard <56915010+michaelbrusegard@users.noreply.github.com> Date: Thu, 7 Mar 2024 15:30:21 +0100 Subject: [PATCH 2/3] chore: specify python version in string --- .github/workflows/integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 476ec19c3..fd7c11935 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -17,7 +17,7 @@ jobs: - name: Set up Python 3.10 uses: actions/setup-python@v5 with: - python-version: 3.10 + python-version: "3.10" - name: Install dependencies run: | python -m pip install --upgrade pip From 57d422534ea4d22af76ec81af4227f83c0db0fb9 Mon Sep 17 00:00:00 2001 From: Michael Brusegard <56915010+michaelbrusegard@users.noreply.github.com> Date: Thu, 7 Mar 2024 15:34:48 +0100 Subject: [PATCH 3/3] chore: update ssh action --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c3ed83567..ae8cf0a45 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: executing remote ssh commands using key - uses: appleboy/ssh-action@v0.1.4 + uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.host }} username: ${{ secrets.user }}