build: improve security by using GH actions OIDC (#53) #153
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: Build | |
on: push | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
# deep clone on the `main` branch, so we can properly generated Last Modified metadata for posts based on | |
# git commit history (via `jekyll-last-modified-at` gem) | |
fetch-depth: ${{ github.ref == 'refs/heads/main' && '0' || '1' }} | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: .ruby-version | |
bundler-cache: true | |
- name: Build site | |
run: JEKYLL_ENV=production bundle exec jekyll build | |
- name: Configure AWS Credentials | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
role-to-assume: arn:aws:iam::107111673154:role/benlimmer.com-deploy | |
aws-region: us-east-1 | |
- name: Deploy site | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
export GOPATH=~/go | |
go install github.com/bep/s3deploy/v2@v2.7.0 | |
./deploy.sh |