Netlify Deploy #1851
This file contains hidden or 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: Netlify Deploy | |
on: | |
push: | |
workflow_dispatch: | |
schedule: | |
# 6am ET, posts will publish if rebuilt after 1am ET | |
- cron: "0 10 * * *" | |
jobs: | |
build: | |
env: | |
GOODREADS_KEY: ${{ secrets.GOODREADS_KEY }} | |
MIX_ENV: prod | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: DeterminateSystems/nix-installer-action@main | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
deps | |
_build | |
key: ${{ runner.os }}-mix-${{ hashFiles('**/flake.nix') }}-${{ hashFiles('**/mix.lock') }} | |
restore-keys: | | |
${{ runner.os }}-mix- | |
- name: Remove stale goodreads data | |
run: rm _build/books.bin | |
- name: Install Dependencies | |
run: nix develop .#netlify --command bash -c 'mix deps.get' | |
- name: Build | |
run: nix develop .#netlify --command bash -c 'mix build' | |
- name: Deploy Branch Preview | |
if: ${{ github.ref_name != 'main' }} | |
run: nix develop .#netlify --command bash -c 'netlify deploy --alias ${{ github.ref_name}}' | |
- name: Deploy Production | |
if: ${{ github.ref_name == 'main' }} | |
run: nix develop .#netlify --command bash -c 'netlify deploy --prod' | |