-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (54 loc) · 1.72 KB
/
Copy pathupgrade-tmp.yml
File metadata and controls
65 lines (54 loc) · 1.72 KB
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
name: "System Upgrade"
on:
workflow_dispatch:
inputs:
ip:
description: 'Ip or Domain'
type: string
required: true
flakeAttr:
description: 'OS Config Hostname'
type: string
arch:
description: 'Target architecture'
type: choice
required: true
default: 'x86_64'
options:
- x86_64
- aarch64
jobs:
Update:
runs-on: ${{ inputs.arch == 'aarch64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@master
- uses: NixOS/nix-installer-action@main
- run: |
mkdir -m 0755 ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
cat > ~/.ssh/config <<EOF
Host installee
HostName ${{ inputs.ip }}
HostKeyAlias installee
User root
StrictHostKeyChecking no
EOF
- name: System Build
run: |
outPath=$(nix build --no-link --print-out-paths .#nixosConfigurations.${{ inputs.flakeAttr }}.config.system.build.toplevel)
echo "outPath=$outPath" >> "$GITHUB_ENV"
- run: |
until ssh -o ConnectTimeout=10 installee ls /etc/os-release
do
echo "Machine Not Reachable, Waiting..."
sleep 5
done
- name: Nix copy
run: nix copy --to ssh://installee $outPath
- name: Diff closures
run: ssh installee nix store diff-closures /run/current-system $outPath
- name: Set system profile
run: ssh installee nix-env -p /nix/var/nix/profiles/system --set $outPath
- name: Switch configuration
run: ssh installee $outPath/bin/switch-to-configuration switch