#3 Updated Api for chat history. #30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Sphinx Docs to AWS S3 | |
on: | |
push: | |
branches: | |
- main | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.M_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.M_AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: eu-central-1 | |
S3_BUCKET: s3-doc-hosting-123124525 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install sphinx myst-parser sphinx_rtd_theme | |
- name: Build documentation | |
run: sphinx-build -b html docs/source/ docs/build/html | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
aws-access-key-id: ${{ secrets.M_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.M_AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Sync to S3 | |
run: | | |
aws s3 sync docs/build/html s3://${{ env.S3_BUCKET }} --delete --acl public-read | |
- name: Check for CloudFront Distribution ID | |
id: check_cloudfront | |
run: | | |
if [ -n "${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}" ]; then | |
echo "cloudfront_id_exists=true" >> $GITHUB_ENV | |
else | |
echo "cloudfront_id_exists=false" >> $GITHUB_ENV | |
fi | |
- name: Invalidate CloudFront (optional) | |
if: env.cloudfront_id_exists == 'true' | |
run: | | |
aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*" |