A Blogging Platform

version: 0.1 
phases:
install:
commands:
- curl -Ls https://github.com/spf13/hugo/releases/download/v0.59.1/hugo_0.59.1_Linux-64bit.tar.gz -o /tmp/hugo.tar.gz
- tar xf /tmp/hugo.tar.gz -C /tmp
build:
commands:
- /tmp/hugo
post_build:
commands:
- aws s3 sync --delete --acl public-read public s3://s3-bucket-name
name: Build and Deploy 
on: push
jobs:
build:
name: Build and Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install Hugo
run: | HUGO_DOWNLOAD=hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/${HUGO_DOWNLOAD} tar xvzf ${HUGO_DOWNLOAD} hugo mv hugo $HOME/hugo
env: HUGO_VERSION: 0.59.1
- name: Hugo Build
run: cd $GITHUB_WORKSPACE/website && $HOME/hugo -v
- name: Deploy to S3
if: github.ref == 'refs/heads/master'
run: cd $GITHUB_WORKSPACE/website && $HOME/hugo -v deploy --maxDeletes -1
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
[deployment]
order = [".png$", ".jpg$", ".gif$", ".svg$"]
[[deployment.targets]]
URL = "s3://s3-bucket-name?region=region-name"
[[deployment.matchers]]
# Cache static assets for 20 years.
pattern = "^.+\\.(js|css|png|jpg|gif|svg|ttf)$"
cacheControl = "max-age=630720000, no-transform, public"
gzip = true
[[deployment.matchers]]
pattern = "^.+\\.(html|xml|json)$" gzip = true

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
JD

JD

Drink to Code and Code to Drink