-
Notifications
You must be signed in to change notification settings - Fork 70
87 lines (70 loc) · 2.15 KB
/
build.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
name: Build
jobs:
build:
runs-on: ubuntu-latest
env:
mailmap: ${{ secrets.MAILMAP }}
steps:
- name: Checkout ⬇️
uses: actions/checkout@v4
with:
fetch-depth: 0 # we need the commit history for authors
- name: Install Nix ❄️
uses: cachix/install-nix-action@v26
- name: Set up Cachix ♻️
uses: cachix/cachix-action@v14
with:
name: 1lab
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: Check that imports are sorted
if: github.event_name == 'pull_request'
run: |
nix run -f . sort-imports
if ! git diff --quiet; then
echo 'Imports are not sorted. Please run `support/sort-imports.hs`.'
exit 1
fi
- 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@v4
with:
path: _build
key: shake-5-${{ env.shake_version }}-${{ github.run_id }}
restore-keys: shake-5-${{ env.shake_version }}-
- name: Build 🛠️
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
eval "$installPhase"
- name: Upload site ⬆️
uses: actions/upload-pages-artifact@v3
with:
path: _build/site
retention-days: 1
deploy:
needs: build
if: ${{ github.ref_name == 'main' }}
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy 🚀
id: deployment
uses: actions/deploy-pages@v4