-
Notifications
You must be signed in to change notification settings - Fork 4
139 lines (120 loc) · 4.64 KB
/
deploy-docs-prod.yaml
File metadata and controls
139 lines (120 loc) · 4.64 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Deploy docs site to production
on:
push:
branches:
- prod
workflow_run:
workflows: ["Merge staging into prod"]
types:
- completed
workflow_dispatch:
jobs:
deploy:
if: |
github.event_name == 'push' ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') ||
github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Check out documentation repository
uses: actions/checkout@v4
# Reclaim space + create a reserve for deterministic headroom
- name: Free space + create reserve
uses: ./.github/actions/free-disk-space
with:
remove_dotnet: "true"
remove_android: "true"
remove_haskell: "true"
prune_docker: "true"
apt_cleanup: "true"
create_reserve_gb: "3"
- name: Check out validmind-library repository
uses: actions/checkout@v4
with:
repository: validmind/validmind-library
path: site/_source/validmind-library
token: ${{ secrets.DOCS_CI_RO_PAT }}
- name: Check out installation repository
uses: actions/checkout@v4
with:
repository: validmind/installation
path: site/_source/installation
token: ${{ secrets.DOCS_CI_RO_PAT }}
sparse-checkout: |
site/installation
sparse-checkout-cone-mode: true
- name: Check out release-notes repository
uses: actions/checkout@v4
with:
repository: validmind/release-notes
path: site/_source/release-notes
token: ${{ secrets.DOCS_CI_RO_PAT }}
sparse-checkout: |
releases
sparse-checkout-cone-mode: true
- name: Check out backend repository
uses: actions/checkout@v4
with:
repository: validmind/backend
path: site/_source/backend
token: ${{ secrets.DOCS_CI_RO_PAT }}
sparse-checkout: |
src/backend/templates/documentation/model_documentation
sparse-checkout-cone-mode: true
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
version: ${{ vars.QUARTO_VERSION }}
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Generate Python library docs
run: |
cd site/_source/validmind-library
make install && make quarto-docs
cd ../../
rm -rf validmind
mkdir -p validmind
rsync -av --exclude '_build' --exclude 'templates' _source/validmind-library/docs/ validmind/
- name: Generate template schema docs
run: |
pip install json-schema-for-humans
BACKEND_ROOT=site/_source/backend python scripts/generate_template_schema_docs.py
- name: Populate installation
run: cp -r site/_source/installation/site/installation site/installation
- name: Populate release notes
run: |
cp -r site/_source/release-notes/releases site
rm -f site/releases/backend-releases.qmd site/releases/cmvm-releases.qmd
- name: Render prod docs site
run: |
cd site
quarto render --profile production &> render_errors.log || {
echo "Quarto render failed immediately";
cat render_errors.log;
exit 1;
}
make generate-sitemap
# Prod bucket is in us-east-1
- name: Configure AWS credentials
run: aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID_PROD }} && aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY_PROD }} && aws configure set default.region us-east-1
- name: Deploy docs prod site
run: aws s3 sync site/_site s3://validmind-docs-prod/site --delete --exclude "installation/omnibus/*" --exclude "installation/helm-repo/*" --exclude "notebooks/EXECUTED/*" --exclude "llm/*" && aws cloudfront create-invalidation --distribution-id E2BGG3USKQTR9W --paths "/*" --no-cli-pager
# Release headroom and shrink before final lightweight steps & post-job
- name: Release reserve & shrink
if: always()
uses: ./.github/actions/free-disk-space
with:
release_reserve: "true"
remove_paths: |
site/_source/installation
site/_source/release-notes
site/_source/backend
site/render_errors.log
site/_freeze
dev.env
valid.env
- name: Final disk usage
if: always()
run: df -hT /