-
Notifications
You must be signed in to change notification settings - Fork 2
52 lines (43 loc) · 1.23 KB
/
deploy-preview.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Build and Deploy Preview
on:
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v11
- name: Setup Nix build cache
uses: DeterminateSystems/magic-nix-cache-action@v6
- name: Check Nix flake inputs
uses: DeterminateSystems/flake-checker-action@v7
- name: Build website
run: nix build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: result
path: result/
deploy:
runs-on: ubuntu-latest
needs: build
environment:
name: Preview
url: https://pr-${{ github.event.number }}.berkeley-mt.pages.dev
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: result
- name: Deploy to Cloudflare Pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: 44d0498f26e72b3e24b3ba9d152ca879
projectName: berkeley-mt
branch: pr-${{ github.event.number }}
directory: .