49 lines (41 loc) · 1.19 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
name: Deploy Config
on:
push:
branches:
- "main"
check_suite:
types: [completed]
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event.check_suite.conclusion == 'success'
strategy:
matrix:
machine:
- "agamemnon"
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Tailscale
uses: tailscale/github-action@main
with:
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
oauth-secret: ${{ secrets.TS_OAUTH_CLIENT_SECRET }}
tags: tag:ci
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
with:
extra-conf: |
substituters = https://cache.garnix.io
trusted-public-keys = cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=
- name: Add agamemnon to known hosts
id: ssh-known-hosts
run: |
mkdir -p ~/.ssh
ssh-keyscan ${{ matrix.machine }} >> ~/.ssh/known_hosts
- name: Build and deploy
run: |
set -euxo pipefail
nix flake check
nix run github:serokell/deploy-rs -- --hostname=${{ matrix.machine }}