-
Notifications
You must be signed in to change notification settings - Fork 1
60 lines (48 loc) · 1.85 KB
/
deploy_index.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
name: Deploy Index to S3
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.8 ]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install requirements
run: |
python3 -m pip install -r requirements.txt
sudo snap install yq
- name: Build website
run: |
mkdir ./build
mkdir ./build/docs
mkdir ./build/docs/assets
cp ./mkdocs.yml ./build/mkdocs.yml
cp -r ./assets/images ./build/docs/assets/images
cp -r ./assets/css ./build/docs/assets/css
site_name="Diskover Documentation" yq e '.site_name = env(site_name)' -i ./build/mkdocs.yml
cp ./assets/pages/header.md ./build/docs/index.md
cat ./assets/pages/index.md >> ./build/docs/index.md
echo "Copying images"
cp -r ./source_files/images ./build/docs/images
cd ./build
python3 -m mkdocs build
rm -f ./site/404.html
- name: S3 sync
run: |
aws s3 sync --follow-symlinks ./build/site s3://$AWS_S3_BUCKET
aws s3 cp ./assets/pages/404.html s3://$AWS_S3_BUCKET/404.html
aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths "/*" >/dev/null 2>&1
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_REGION: 'us-east-1'
DISTRIBUTION_ID: ${{ secrets.DISTRIBUTION_ID }}