Skip to content

update actions

update actions #7

Workflow file for this run

name: Deploy Hugo Site to S3 with OIDC
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy-to-prod:
runs-on: ubuntu-latest
environment: prod
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3
- name: Get AWS credentials using OIDC
id: assume-role
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ secrets.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_DEPLOY_ROLE_ARN }}
role-session-name: hugo-deploy-${{ github.run_id }}
- name: Set up Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: latest
- name: Build the Hugo site
run: hugo
- name: Deploy to S3
run: |
aws s3 ls site-prod-devopsloop-site-origin
aws s3 cp public/ s3://site-prod-devopsloop-site-origin?region=us-east-1
hugo deploy --target prod # Change target to a var if you have multiple target envs
- name: Invalidate CloudFront cache (optional)
run: aws cloudfront create-invalidation --distribution-id ${{secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID}} --paths "/*"