aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows/infra-metal.yml
blob: 80e094b6bad3855dae16a14bee9d6a19de2e558c (plain) (blame)
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
name: infra-metal

on:
  workflow_call:
    inputs:
      limit:
        description: 'Ansible hosts'
        type: string
        default: all
        required: false
  workflow_dispatch:
    inputs:
      limit:
        description: 'Ansible hosts'
        type: string
        default: all
        required: false

jobs:
  maintenance:
    runs-on: ubuntu-latest
    steps:
      - name: Set up WireGuard
        uses: egor-tensin/setup-wireguard@v1
        with:
          endpoint: '${{ secrets.WG_ENDPOINT }}'
          endpoint_public_key: '${{ secrets.WG_ENDPOINT_PUBLIC }}'
          ips: '${{ secrets.WG_IPS }}'
          allowed_ips: '${{ secrets.WG_ALLOWED_IPS }}'
          private_key: '${{ secrets.WG_PRIVATE }}'
          preshared_key: '${{ secrets.WG_PRESHARED }}'
      - name: Configure SSH
        run: |
          mkdir -p ~/.ssh
          cat > ~/.ssh/config <<'EOF'
          StrictHostKeyChecking no
          EOF
      - name: Set up ssh-agent
        uses: webfactory/ssh-agent@v0.9.1
        with:
          ssh-private-key: '${{ secrets.SSH_KEY }}'
      - name: Checkout
        run: |
          git clone -q ssh://git@bitbucket.org/egor-tensin/infra-metal.git
      - name: Configure git
        run: |
          git config --global user.name 'Egor Tensin'
          git config --global user.email 'egor@tensin.name'
      - name: Run maintenance
        run: |
          make -C infra-metal maintenance 'LIMIT=${{ inputs.limit }}'