pds dash for shimaenaga.veryroundbird.house (based off of pds.witchcraft.systems)
1when:
2 - event: ["push", "manual"]
3 branch: ["main"]
4
5engine: "nixery"
6
7dependencies:
8 nixpkgs:
9 - deno
10 - openssh
11 - su
12
13steps:
14 - name: "Pretend we have a real local user"
15 command: |
16 echo "🪶 pretend root is a real user"
17 echo "root:x:0:0:System administrator:/root:/run/current-system/sw/bin/bash" >> /etc/passwd
18
19 - name: "Copy config to server"
20 command: |
21 echo "🪶 copying config from secrets"
22 echo "${CONFIG}" > config.ts
23
24 - name: "Set up Deno"
25 command: |
26 echo "🪶 installing deno packages"
27 deno install
28
29 - name: "Build static files"
30 command: |
31 echo "🪶 building static files"
32 deno run build
33
34 - name: "SSH setup"
35 command: |
36 echo "🪶 setting up ssh connection"
37 mkdir ~/.ssh
38 echo "${SSH_KEY}" > ~/.ssh/id_tangledsh
39 chmod 600 ~/.ssh/id_tangledsh
40 cat > /etc/ssh/ssh_config << EOF
41 Host deploy
42 HostName ${SERVER_HOST}
43 User ${SERVER_USER}
44 IdentityFile ~/.ssh/id_tangledsh
45 StrictHostKeyChecking no
46 UserKnownHostsFile /dev/null
47 BatchMode yes
48 PasswordAuthentication no
49 PubkeyAuthentication yes
50 EOF
51 chmod 600 /etc/ssh/ssh_config
52 ssh-keyscan -H $SERVER_HOST >> ~/.ssh/known_hosts
53
54 - name: "Deploy via SCP"
55 command: |
56 echo "🪶 deploying files via scp"
57 scp -r ./dist/* deploy:/pds/caddy/etc/caddy/static
58
59 - name: "Done!"
60 command: |
61 echo "🪶 all done!