-
Notifications
You must be signed in to change notification settings - Fork 2
70 lines (66 loc) · 1.98 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Test and Deploy
on:
workflow_dispatch:
push:
jobs:
deploy:
runs-on: ubuntu-latest
env:
DEBUG: True
SECRET_KEY: changeme
DATABASE_URL: postgres://[email protected]/dienst2?atomic_requests=True
CACHE_URL: dummycache://
SEARCH_URL: simple://
GOOGLE_IAP_AUDIENCE: /projects/966138216790/apps/wisvch
services:
postgres:
image: postgres:15.2
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: dienst2
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install prerequisites
run: |
sudo apt-get install libpq-dev
sudo apt-get install libssl-dev
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry
poetry config virtualenvs.create false
poetry install
- name: Run migrations
run: python manage.py migrate
- name: Run tests
run: python manage.py test
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/wisvch/dienst2
tags: type=sha, prefix={{date 'YYYYMMDD'}}-
- name: Setup Docker BuildX
uses: docker/setup-buildx-action@v2
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: ${{ github.ref == 'refs/heads/master' }}