Build and Deploy Hugo Static Web Site #1085
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: 'Build and Deploy Hugo Static Web Site' | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: "0 2 * * *" | |
env: | |
AWS_REGION : us-east-1 | |
# Permission can be added at job level or workflow level | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
contents: read # This is required for actions/checkout | |
jobs: | |
hugo-build-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Git clone the repository | |
uses: actions/checkout@v3 | |
- name: Install Python graphing dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r src/python/requirements.txt | |
- name: Build plotly graph data | |
run: | | |
cd src/python | |
python ./river-data.py | |
- name: configure aws credentials | |
uses: aws-actions/[email protected] | |
with: | |
role-to-assume: arn:aws:iam::052490168305:role/kampmeier-2232-defiance-web-site-publishing | |
role-session-name: GitHub_to_AWS_via_FederatedOIDC | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Install Dart Sass Embedded # Installs dart-sass | |
run: sudo snap install dart-sass-embedded | |
- name: Set up Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: '0.126.2' | |
extended: true | |
- name: Build | |
run: hugo | |
- name: Deploy to S3 | |
run: hugo deploy --force --maxDeletes -1 --invalidateCDN |