S3/CloudFront deployment docs.carpentries.org #8
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: S3/CloudFront deployment beta.docs.carpentries.org | |
on: | |
push: | |
branches: main | |
schedule: | |
- cron: '30 */6 * * *' | |
workflow_dispatch: | |
jobs: | |
build-website: | |
if: github.repository_owner == 'carpentries' | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout the Repository | |
uses: actions/checkout@v2 | |
- name: Install sphinx dependencies | |
run: | | |
pip install sphinx_panels myst_parser | |
- name: Build site | |
uses: Kjuly/sphinx-builder@main | |
with: | |
source_root: "source/" | |
build_root: "build/" | |
- name: Deploy to AWS S3 | |
id: deploy | |
uses: fmichonneau/s3-sync-action@log-output | |
with: | |
args: --acl public-read --follow-symlinks --delete | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
SOURCE_DIR: build/ | |
- name: Invalidate CloudFront | |
uses: chetan/invalidate-cloudfront-action@master | |
env: | |
PATHS: /* | |
AWS_REGION: 'us-east-1' | |
DISTRIBUTION: ${{ secrets.DISTRIBUTION }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |