summaryrefslogtreecommitdiff
path: root/.github/workflows/deploy.yaml
blob: 8c3ecac7ee7320f803ae7cd096613897820e1bd8 (plain)
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
name: deploy systems

on:
  check_suite:
    types: [completed]
  workflow_dispatch:

jobs:
  deploy:
    runs-on: ubuntu-latest

    # https://github.com/sellout/bash-strict-mode/commit/9bf1d65c2f786a9887facfcb81e06d8b8b5f4667
    if: github.event.check_suite.app.name == 'Garnix CI'
      && github.event.check_suite.conclusion == 'success'
      && github.event.check_suite.latest_check_runs_count >= 12
      && github.event.check_suite.head_branch == 'main'

    steps:
      - uses: actions/checkout@v4

      - name: install nix
        uses: nixbuild/nix-quick-install-action@v26

      - name: connect to tailscale
        uses: tailscale/github-action@v2
        with:
            oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
            oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
            tags: tag:gha

      - name: disable host key verification for ssh
        run: |
          set -eux

          [ ! -d ~/.ssh ] && mkdir -p ~/.ssh
          cat >> ~/.ssh/config << EOF
          Host *
              StrictHostKeyChecking no
              UserKnownHostsFile=/dev/null
          EOF

      - name: deploy all systems
        run: |
          nix develop --accept-flake-config \
            --command bash \
            -c "just deploy-all"