Skip to content

Commit

Permalink
feat: ci
Browse files Browse the repository at this point in the history
  • Loading branch information
rswanson committed Apr 15, 2024
1 parent ac0fc43 commit f4c9ddc
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Hugo s3 deploy

on:
push:
branches:
- main
pull_request:

permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Build
run: hugo --minify --destination dist
- name: Archive build directory
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
deploy-prod:
environment:
name: Production
# only runs when the branch is main
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: build
steps:
- name: Download build artifact
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.IAM_DEPLOYER_ROLE }}
role-session-name: github_federated_aws
aws-region: ${{ vars.AWS_REGION }}
- name: Deploy Site to S3
env:
AWS_S3_BUCKET : ${{ secrets.AWS_S3_BUCKET }}
run: |
aws s3 sync --delete --sse AES256 dist/ $AWS_S3_BUCKET

0 comments on commit f4c9ddc

Please sign in to comment.