-
Notifications
You must be signed in to change notification settings - Fork 11
71 lines (61 loc) · 1.73 KB
/
deploy.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
---
name: Deploy 🚀
'on':
push:
branches:
- main
paths:
- '**.nix'
- '**.age'
- 'flake.lock'
concurrency:
group: ci-${{ github.ref }}-deploy
cancel-in-progress: true
jobs:
check:
name: Check ✔️
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v16
- uses: DeterminateSystems/magic-nix-cache-action@v8
- uses: cachix/cachix-action@v15
with:
name: etu
extraPullNames: 'nix-community'
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Check the flake
run: 'nix flake check'
deploy:
name: Deploy 🚀
runs-on: ubuntu-22.04
needs: check
# Don't cancel jobs if one job fails
continue-on-error: true
strategy:
matrix:
hostname:
- server-main-elis
- server-sparv
- vps06
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@v16
- uses: DeterminateSystems/magic-nix-cache-action@v8
- uses: cachix/cachix-action@v15
with:
name: etu
extraPullNames: 'nix-community'
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
# Build systems.
- name: Build system derivation
run: 'nix build .#nixosConfigurations.${{ matrix.hostname }}.config.system.build.toplevel'
# Configure SSH key
- uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
name: id_ed25519
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
# Deploy systems
- name: Deploy system
run: 'nix develop -c deploy --skip-checks --targets .#${{ matrix.hostname }}'