Skip to content

AlbertMorenoDEV/deploy-hugo-to-s3-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 

Repository files navigation

Deploy Hugo To S3 Action

This GitHub action makes it easy to build and deploy any Hugo static website to AWS S3 with just one step.

Example

---
name: Hugo Build and Deploy to S3

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  build:
    name: Build and Deploy
    runs-on: ubuntu-latest
    steps:
      - name: Check out master
        uses: actions/checkout@master

      - name: Build and deploy
        uses: AlbertMorenoDEV/deploy-hugo-to-s3-action@v0.0.10
        with:
          hugo-version: 0.139.0
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

Custom Config File

Optional config to specify a custom config file. Handy for Hugo sites that have more than one config file.

Example

GitHub Action

---
name: Hugo Build and Deploy to S3

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  build:
    name: Build and Deploy
    runs-on: ubuntu-latest
    steps:
      - name: Check out master
        uses: actions/checkout@master

      - name: Build and deploy
        uses: AlbertMorenoDEV/deploy-hugo-to-s3-action@v0.0.10
        with:
          hugo-version: 0.139.0
          config: path/config.toml
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

Targets

Optional input to specify a deployment target. Handy for Hugo sites that have multiple environments (e.g. "staging" and "production").

If target is not specified in your GitHub Action, the first deployment target is used by default.

Example

GitHub Action

name: Hugo Build and Deploy to S3

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

jobs:
  build:
    name: Build and Deploy
    runs-on: ubuntu-latest
    steps:
      - name: Check out master
        uses: actions/checkout@master

      - name: Build and deploy
        uses: AlbertMorenoDEV/deploy-hugo-to-s3-action@v0.0.10
        with:
          hugo-version: 0.139.0
          target: production
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

Hugo Config

---
baseURL: /
languageCode: en-us
title: Example Site

# -------------- AWS S3 Deployment Configs -------------- #

deployment:
  targets:
    - name: "staging"
      URL: "s3://stg.example.com?region=us-east-2"
    - name: "production"
      URL: "s3://example.com?region=us-east-1"

About

Build and deploy Hugo static websites to AWS S3

Resources

Stars

Watchers

Forks

Packages

No packages published