forked from GaijinEntertainment/quirrel
-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (66 loc) · 1.94 KB
/
docs_build_deploy.yaml
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
name: Docs - build and deploy
on:
push:
branches:
- master
paths:
- "doc/**"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
outputs:
artifact_name: ${{ steps.artifact_name.outputs.artifact_name }}
permissions:
contents: read
steps:
- name: Checkout project
uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"
- name: Install dependencies
working-directory: ./doc
run: python3 -m pip install -r requirements.txt
- name: Build documentation with sphinx-build
working-directory: ./doc
run: sphinx-build -b html -d build/doctrees source build/html
- name: Generate artifact name
id: artifact_name
run: |
export AN=docs_html_$(date +'%Y%m%dT%H%M%S')
echo Generated artifact name: ${AN}
echo "ARTIFACT_NAME=${AN}" >> $GITHUB_ENV
echo "artifact_name=${AN}" >> $GITHUB_OUTPUT
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: ./doc/build/html
retention-days: 1
if-no-files-found: error
deploy:
needs: build
runs-on: ubuntu-latest
env:
ARTIFACT_NAME: ${{ needs.build.outputs.artifact_name }}
permissions:
actions: read
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: ./doc
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.DOC_KEYID }}
aws-secret-access-key: ${{ secrets.DOC_SECRET }}
aws-region: eu-west-1
- name: Update target
run: |
aws s3 sync ./doc s3://quirrel.io/doc
aws cloudfront create-invalidation --distribution-id ${{ secrets.DOC_DISTID }} --paths "/*"