Keep deploy limited to pushes on master so PR CI validates changes without deploying.
37 lines
798 B
YAML
37 lines
798 B
YAML
name: Deploy Company Site
|
|
|
|
on:
|
|
push:
|
|
branches: [master]
|
|
pull_request:
|
|
branches: [master]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: self-hosted
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python environment
|
|
run: |
|
|
python3 -m venv .venv
|
|
.venv/bin/pip install --upgrade pip
|
|
.venv/bin/pip install -r requirements.txt
|
|
|
|
- name: Run unit tests
|
|
run: |
|
|
cd company_site
|
|
../.venv/bin/python manage.py test
|
|
|
|
deploy:
|
|
needs: test
|
|
if: gitea.event_name == 'push' && gitea.ref == 'refs/heads/master'
|
|
runs-on: self-hosted
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Deploy to live site
|
|
run: bash scripts/deploy.sh "${{ gitea.workspace }}"
|