summaryrefslogtreecommitdiff
path: root/.github/workflows/deploy.yml
blob: 34c55ed72168aa4826f4c2d73e116ec1617e43dc (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
name: Deploy Hugo

on:
  push:
    branches: [main]

jobs:
  deploy:
    environment: site - tierhive
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Setup Hugo
        uses: peaceiris/actions-hugo@v3
        with:
          hugo-version: 'latest'
          extended: true

      - name: Build
        run: hugo --minify

      - name: Install lftp
        run: sudo apt-get update && sudo apt-get install -y lftp

      - name: Deploy
        env:
          TH_USER: ${{ secrets.TH_USER }}
          TH_KEY: ${{ secrets.TH_KEY }}
        run: |
          mkdir -p ~/.ssh
          chmod 700 ~/.ssh

          printf '%s\n' "$TH_KEY" > ~/.ssh/tierhive_key
          chmod 600 ~/.ssh/tierhive_key

          lftp sftp://$TH_USER@us.4.pages.tierhive.com:3523 \
            -e "
              set sftp:connect-program 'ssh -a -x -i ~/.ssh/tierhive_key -o StrictHostKeyChecking=no';
              mirror --reverse --delete public/ page-stellarrounin-com/;
              quit
            "