Skip to content

Instantly share code, notes, and snippets.

@flawyte
Last active April 19, 2020 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flawyte/ca024785824461486402c89cca1f8b30 to your computer and use it in GitHub Desktop.
Save flawyte/ca024785824461486402c89cca1f8b30 to your computer and use it in GitHub Desktop.
GitHub Action to automatically rebuild and redeploy a website to ZEIT Now whenever content is edited in the CMS.
name: Build & Deploy to Production
# Run when a dispatch event is created (e.g. from a CMS Webhook)
# See https://developer.github.com/v3/repos/#create-a-repository-dispatch-event
on: [repository_dispatch]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1 # Equivalent to `git checkout master`
- name: Install dependencies
run: yarn
- name: Build
run: yarn build
- name: Deploy
run: now _build/ --prod -t ${{ secrets.ZEIT_TOKEN }}
# The `_build/` argument is optional. In my case it's the directory where `yarn build` puts the final code to
# deploy. If you want to deploy the current directory instead, just remove this argument.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment