-
Notifications
You must be signed in to change notification settings - Fork 9
109 lines (95 loc) · 2.85 KB
/
docs.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Publish Documentation
on: push
jobs:
docs:
runs-on: ubuntu-latest
env:
DJANGO_SETTINGS_MODULE: 'backend.settings.test'
REDIS_PORT: 6379
REDIS_CONFIG_DB: 1
REDIS_CACHE_DB: 2
REDIS_HOST: localhost
SQL_PORT: 5432
SQL_USER: ractf
SQL_HOST: localhost
SQL_DATABASE: ractf
SQL_PASSWORD: postgres
services:
postgres:
image: postgres:12-alpine
env:
POSTGRES_PASSWORD: postgres
POSTGRES_EXTENSIONS: citext
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_DB: ractf
POSTGRES_USER: ractf
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis:5
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- uses: actions/setup-node@v2-beta
with:
node-version: '14'
- name: Cache Python modules
uses: actions/cache@v1
env:
cache-name: cache-node-modules
with:
path: ~/.pip
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-
restore-keys: |
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Poetry
run: curl -sSL https://install.python-poetry.org | python3 -
- name: Disable Virtualenvs
run: $HOME/.local/bin/poetry config virtualenvs.create false
- name: Install Python Dependencies
run: $HOME/.local/bin/poetry install --no-interaction --no-ansi
env:
PIP_CACHE_DIR: ~/.pip
- name: Run Migrations
run: ./manage.py migrate
working-directory: ./src
- name: Generate OpenAPI schema
run: set -eo pipefail && ./src/manage.py getschema | tee openapi-schema.yml
- name: Publish API documentation to GitHub
uses: actions/upload-artifact@v2
with:
name: openapi-schema.yml
path: openapi-schema.yml
- name: Trigger docs-site build
if: github.ref == 'refs/heads/master'
run: |
curl -X POST ${{ secrets.WEBHOOK_URL }} \
-H 'Authorization: token ${{ secrets.WEBHOOK_TOKEN }}' \
--data '{"event_type": "deploy_docs_site"}'