chore(deps): update actions/checkout digest to b4ffde6 #70
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: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 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: Setup Hugo | |
run: | | |
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: 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: | | |
S3DEPLOY_VERSION=$(grep s3deploy go.mod | awk '{print $NF}' | sed 's/^v//') | |
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 |