Deploy Hugo to AWS S3 with GitHub Actions and CloudFront

What You can deploy the hugo project to s3 directly when you make a push to github repository. this is a guide for that. you are going to use AWS s3, IAM role with s3 access and cloudfront access if you want to use cloudfront in front of s3 bucket. How the github action for your repo will be name: Deploy to S3 on: push: branches: - master jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 with: submodules: true - name: Set up Hugo uses: peaceiris/actions-hugo@v3 with: hugo-version: 'latest' - name: Build the Hugo site run: hugo --verbose --debug - name: Sync S3 bucket uses: jakejarvis/s3-sync-action@master with: args: --delete env: AWS_S3_BUCKET: your-bucket AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_REGION: 'us-west-1' SOURCE_DIR: 'public' - name: Invalidate CloudFront uses: chetan/invalidate-cloudfront-action@v2 env: DISTRIBUTION: YOUR-CF-DIST-ID PATHS: "/*" AWS_REGION: "us-east-1" AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} If you are not using CloudFront, ignore the invalidation step and you are good to go. ...

October 22, 2024 · 1 min · 190 words · Sagar Nayak

Cusdis Docker Setup for Hugo

What You deploy Cusdis via Docker, add the provided script and HTML block to your PaperMod Hugo project, and all of a sudden the Cusdis iframe is not taking the correct height. Here is how to fix it. Why Why is this problem happening? After looking at the code provided by the cusdis deployment for adding into the hugo project. <div id="cusdis_thread" data-host="https://your-deployment-url" data-app-id="YOUR-APP-ID" data-page-id="{{ PAGE_ID }}" data-page-url="{{ PAGE_URL }}" data-page-title="{{ PAGE_TITLE }}" ></div> <script async defer src="https://your-deployment-url/js/cusdis.es.js"></script> the script cusdis.es.js has different code then what you get if you would have used the official cusdis deployment to create a project and tried to get the html block from that project. ...

September 8, 2024 · 1 min · 196 words · Sagar Nayak