Get hugo from upstream #62
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: Deploy to AWS S3/CloudFront | |
on: | |
push: | |
branches: ["main"] | |
workflow_dispatch: | |
permissions: | |
id-token: write | |
contents: read | |
concurrency: | |
group: "cloudfront" | |
cancel-in-progress: true | |
# Default to bash | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
# Build job | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Hugo | |
run: | | |
# Get the latest hugo version from the go.mod | |
LATEST_HUGO_VERSION=$(grep github.com/gohugoio/hugo go.mod | awk '{print $NF}' | sed 's/^v//') | |
HUGO_DOWNLOAD_URL="https://github.com/gohugoio/hugo/releases/download/v${LATEST_HUGO_VERSION}/hugo_extended_${LATEST_HUGO_VERSION}_linux-amd64.tar.gz" | |
curl -sL --retry 5 "$HUGO_DOWNLOAD_URL" | tar xvzf - hugo | |
./hugo version | |
- name: Checkout | |
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 | |
with: | |
submodules: recursive | |
- name: Configure AWS credentials | |
uses: aws-actions/[email protected] | |
with: | |
role-to-assume: arn:aws:iam::911986281031:role/github-actions-major.io-blog | |
role-duration-seconds: 900 | |
aws-region: us-east-1 | |
- name: Build with Hugo | |
env: | |
HUGO_ENVIRONMENT: production | |
HUGO_ENV: production | |
run: ./hugo --minify -gc | |
- name: Fix RSS feed | |
run: | | |
mkdir -vp public/feed | |
cp public/index.xml public/feed/index.xml | |
cp public/index.xml public/feed/index.html | |
- name: Download s3deploy | |
run: | | |
export S3DEPLOY_VERSION=2.11.0 | |
curl -sLO https://github.com/bep/s3deploy/releases/download/v${S3DEPLOY_VERSION}/s3deploy_${S3DEPLOY_VERSION}_linux-amd64.tar.gz | |
tar -xzf s3deploy_${S3DEPLOY_VERSION}_linux-amd64.tar.gz s3deploy | |
chmod +x s3deploy | |
- name: Deploy to S3 using s3deploy | |
run: | | |
./s3deploy \ | |
--acl public-read \ | |
--region us-east-1 \ | |
--bucket major.io \ | |
--source public \ | |
--distribution-id E2CVUP8JO07HJ2 |