summaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yaml
blob: b1b0b78c1cb0b9181678e1fd5eb094e7a2790b21 (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: CI

on:
  push:
    branches: [main]
    paths:
      - "**.ts"
      - "**.lock"
      - "**.nix"
      - "deno.json"

      - ".github/wokrflows/ci.yaml"
  pull_request:
    paths:
      - "**.ts"
      - "**.lock"
      - "**.nix"
      - "deno.json"

      - ".github/wokrflows/ci.yaml"
  workflow_dispatch:

jobs:
  lint-and-format:
    name: Lint & Format

    runs-on: ubuntu-latest

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

      - name: Install Nix
        uses: DeterminateSystems/nix-installer-action@v14

      - name: Run deno lint
        run: nix develop .#ci --command deno lint

      - name: Run treefmt
        run: nix fmt -- --ci

  deploy:
    name: Deploy
    needs: lint-and-format

    runs-on: ubuntu-latest

    permissions:
      id-token: write

    steps:
      - name: Clone repository
        uses: actions/checkout@v4

      - name: Upload to Deno Deploy
        uses: denoland/deployctl@v1
        with:
          project: teawie-api
          entrypoint: main.ts
          include: |
            main.ts
            lib

            deno.json
            deno.lock