Skip to content

Gem + resuable github action workflow for rendering and uploading websites to S3/CF

Notifications You must be signed in to change notification settings

84codes/website-deployer

Repository files navigation

website-deployer

Gem that can render a static website and upload it to S3 and then invalidate CloudFront.

Used by our website repos.

Usage

Render locally:

bundle exec render-website

Deploy locally:

bundle exec deploy-website

Github Action Workflow

Add it to the Gemfile:

gem 'website-deployer', github: "84codes/website-deployer"

Set up secrets (see naming in YAML below) per website repository. Add the following workflow to the website's actions:

name: Website deployer

on:
  workflow_dispatch:
  push:
    branches:
      - main

jobs:
  website:
    uses: 84codes/website-deployer/.github/workflows/deploy.yml
    with:
      domain: www.cloudamqp.com
    secrets:
      AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
      AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

Tagging a commit with [force deploy] will append --force to the deploy script, i.e. updating all objects and invalidating all cache.

Development

Build the gem

gem build

Install the built gem

gem install --local ./website-deployer-*

Try it in a website repo

bundle update website-deployer

bundle exec render-website

About

Gem + resuable github action workflow for rendering and uploading websites to S3/CF

Resources

Stars

Watchers

Forks

Languages