website/.github/workflows/build.yml

43 lines
1.2 KiB
YAML
Raw Normal View History

2022-11-28 03:17:59 +00:00
name: "Build and deploy to Netlify"
on:
push:
branches:
- master
- drafts/*
- content/*
workflow_run:
workflows:
- "Update webring"
types:
- "completed"
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_ACCESS_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
2022-11-28 03:17:59 +00:00
jobs:
build:
runs-on: ubuntu-latest
steps:
2023-05-30 04:26:44 +00:00
- name: Fetch/cache the fetched URIs
uses: actions/cache@v3
with:
key: open-uri-content-cache
path: |
2023-06-18 10:12:59 +00:00
/tmp/open-uri-cache-foodogsquared-website
2022-11-28 03:17:59 +00:00
- uses: actions/checkout@v3
with:
fetch-depth: 0
2023-04-21 08:37:20 +00:00
- uses: cachix/install-nix-action@v20
2022-11-28 03:17:59 +00:00
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- name: Fetch all 'content/' branches
run: |
2023-04-10 16:32:18 +00:00
git fetch origin +refs/heads/content/*:refs/heads/content/*
- if: github.ref_name == 'master'
name: Build and deploy site
2023-04-24 09:42:27 +00:00
run: |
2023-04-25 10:59:34 +00:00
nix develop --command bash -c "netlify deploy --build --prod"
2023-05-03 05:39:53 +00:00
- if: startsWith('drafts/', github.ref_name)
name: Build and deploy draft versions of the site
run: |
nix develop --command bash -c "netlify deploy --build --context branch-deploy"