Skip to content

Commit

Permalink
Merge pull request #796 from hackerspace-ntnu/795-fix-deploy-action-t…
Browse files Browse the repository at this point in the history
…o-run-on-push

fix: update the workflows
  • Loading branch information
michaelbrusegard authored Mar 7, 2024
2 parents 77ee27e + 57d4225 commit 435b2ed
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 46 deletions.
41 changes: 19 additions & 22 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Deploy to Server

on:
pull_request:
# Change to merge when implemented (still beta)
types: [closed]
push:
branches:
- master

Expand All @@ -12,22 +10,21 @@ jobs:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: executing remote ssh commands using key
uses: appleboy/[email protected]
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/[email protected]
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
46 changes: 24 additions & 22 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
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
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
Expand Down

0 comments on commit 435b2ed

Please sign in to comment.