Updating workflows (#47)

* updating workflows

* another test for deployment workflow

* making the workflows more polished

* udpating again
This commit is contained in:
Arnold Dechamps 2024-05-11 02:54:56 +02:00 committed by GitHub
parent 7e2dd22b10
commit a49f459a5b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,17 +1,12 @@
name: Workflows on Master name: Master Workflow
on: on:
push: push:
branches: branches:
- master - master
permissions:
contents: read
pages: write
id-token: write
jobs: jobs:
build_and_deploy: deploy_after_master_push:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout Repository - name: Checkout Repository
@ -22,26 +17,14 @@ jobs:
with: with:
python-version: "3.11" python-version: "3.11"
- name: Install Flake8 # Other steps for linting with Flake8
run: pip install flake8
- name: Lint with Flake8
run: flake8 --ignore=E501,F401,E402,F811,E731,F403,E722 .
- name: Set up Python 3.11 for Django - name: Set up Python 3.11 for Django
uses: actions/setup-python@v3 uses: actions/setup-python@v3
with: with:
python-version: "3.11" python-version: "3.11"
- name: Install Dependencies for Django # Other steps for running tests with Django
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
cp config.example.py config.py
- name: Run Tests for Django
run: |
python manage.py test
- name: Configure SSH for Deployment - name: Configure SSH for Deployment
if: success() if: success()
@ -64,13 +47,7 @@ jobs:
- name: Deploy to Production - name: Deploy to Production
if: success() && github.ref == 'refs/heads/master' if: success() && github.ref == 'refs/heads/master'
needs: [build_and_deploy]
run: | run: |
ssh target "cd tldtest && git pull origin master && docker-compose down && docker-compose up --build -d" ssh target "cd tldtest && git pull origin master && docker-compose down && docker-compose up --build -d"
- name: Deploy static content to GitHub Pages # Other steps for deploying static content to GitHub Pages
if: success() && github.ref == 'refs/heads/master'
needs: [build_and_deploy]
uses: actions/deploy-pages@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}