summaryrefslogtreecommitdiffhomepage
path: root/.github/workflows/deploy.yml
blob: f993c8aa6ce46491d5d249c60dcb01baf6878a79 (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
name: Deploy
on:
  push:
    branches: [main]
jobs:
  test:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v2

      - name: Set up Deno
        uses: denoland/setup-deno@v2
        with:
          deno-version: v2.x

      - name: Run deno task check
        run: cd services/blog; deno task check

  deploy:
    needs: test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Deploy
        uses: appleboy/ssh-action@cc051b07ed0666619f6ea5703319edf00d06be13
        with:
          key: ${{ secrets.SSH_KEY }}
          host: ${{ secrets.SSH_HOST }}
          username: ${{ secrets.SSH_USERNAME }}
          port: ${{ secrets.SSH_PORT }}
          script: |
            set -e
            cd nsfisis.dev
            git fetch --prune origin
            git restore -- .
            git clean -fd
            git switch -d origin/main
            make deploy