-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (50 loc) · 1.62 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
name: Build and deploy API documentation
on:
push:
branches:
- deploy/staging
- main
paths:
- .github/workflows/docs.yaml
- docs/*
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
publish-docs:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'staging' }}
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@master
with:
role-to-assume: arn:aws:iam::${{ secrets.AwsAccount }}:role/github-actions-role
aws-region: us-east-1
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.10
- name: Install dependencies
run: pip install -r requirements.txt
working-directory: ./docs
- name: Build docs
run: mkdocs build --clean
working-directory: ./docs
- name: Determine correct deploy domain for environment
run: sed -i s/API_HOST/${HOSTNAME}/g docs/site/spec/openapi.*
env:
HOSTNAME: ${{ secrets.Hostname }}.${{ secrets.HostedZone }}
- name: Generate JSON API
uses: openapi-generators/openapitools-generator-action@v1
with:
generator: openapi
openapi-file: docs/site/spec/openapi.yaml
command-args: -o docs/site/spec
- name: Copy to S3
run: aws s3 sync --delete docs/site/ s3://${HOST}-docs.${ZONE}/
env:
HOST: ${{ secrets.Hostname }}
ZONE: ${{ secrets.HostedZone }}