-
Notifications
You must be signed in to change notification settings - Fork 69
67 lines (57 loc) · 1.86 KB
/
preview.yml
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: PR Preview
on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
jobs:
pr-preview:
runs-on: ubuntu-latest
env:
mailmap: ${{ secrets.MAILMAP }}
steps:
- name: Checkout ⬇️
uses: actions/checkout@v3
with:
fetch-depth: 0 # we need the commit history for authors
- name: Install Nix ❄️
uses: cachix/install-nix-action@v20
- name: Set up Cachix ♻️
uses: cachix/cachix-action@v12
with:
name: 1lab
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Build the Shakefile 🧰
run: |
hash=$(nix-build -A shakefile --no-out-link)
hash=${hash#/nix/store/} hash=${hash%%-*}
echo "shake_version=$hash" >> "$GITHUB_ENV"
- name: Cache _build ♻️
uses: actions/cache@v3
with:
path: _build
key: prose-4-${{ env.shake_version }}-${{ github.run_id }}
restore-keys: prose-4-${{ env.shake_version }}-
- name: Build the prose ✍️
run: |
echo "$mailmap" > .mailmap
nix-shell --arg interactive false --run "$build_command"
env:
NIX_BUILD_SHELL: bash
build_command: |
set -eu
1lab-shake -j all --skip-agda -b https://plt-amy.github.io/1lab-previews/pr-256/
eval "$installPhase"
cp -rv _build/site pr-${{ github.event.number }}
- name: Upload 📦
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.PREVIEW_TOKEN }}
with:
source_file: pr-${{ github.event.number }}
destination_repo: 'plt-amy/1lab-previews'
user_email: '[email protected]'
user_name: 'plt-amy'
commit_message: 'Preview of PR #${{ github.event.number }}'