-
-
Notifications
You must be signed in to change notification settings - Fork 81
55 lines (52 loc) · 1.64 KB
/
darwin.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
name: "darwin"
on:
push:
branches: [master]
workflow_dispatch:
concurrency:
group: "darwin"
cancel-in-progress: false
jobs:
deploy:
environment:
name: darwin
strategy:
fail-fast: false
matrix:
host: [darwin02, darwin03]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v23
with:
extra_nix_config: |
accept-flake-config = true
experimental-features = nix-command flakes
- name: Setup SSH
env:
SSH_KEY: "${{ secrets.SSH_KEY }}"
run: |
mkdir -p "$HOME/.ssh"
cat >>"$HOME/.ssh/id_ed25519" <<EOF
$SSH_KEY
EOF
chmod 600 "$HOME/.ssh/id_ed25519"
cat >>"$HOME/.ssh/known_hosts" <<EOF
darwin02.nix-community.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICJqwpMUEl1/iwrBakeDb1rlheXlE5mfDLICVz8w6yi6
darwin03.nix-community.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKX7W1ztzAtVXT+NBMITU+JLXcIE5HTEOd7Q3fQNu80S
EOF
cat >>"$HOME/.ssh/config" <<EOF
Host *
IdentityFile ~/.ssh/id_ed25519
IdentitiesOnly yes
User hetzner
EOF
- name: Deploy
run: |
./inv deploy --hosts ${{ matrix.host }}
- name: Alert on failure
if: ${{ failure() }}
run: |
curl -XPOST -d '{"msgtype":"m.text", "body":"${{ matrix.host }}: deployment failed"}' \
"https://matrix.org/_matrix/client/r0/rooms/!cBybDCkeRlSWfuaFvn:numtide.com/send/m.room.message?access_token=${{ secrets.TOKEN_MATRIX_BOT }}"