-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (105 loc) Β· 3.48 KB
/
ci.yml
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Check Bun version
run: bun --version
- name: Check TypeScript version
run: bunx tsc --version
- name: Format code
run: bun run format
- name: Lint code
run: bun run lint
- name: Type check
run: bunx tsc --noEmit
- name: Create dist directory
run: mkdir -p dist
- name: Build
run: bunx tsc
- name: Check dist directory
run: ls -R dist || echo "dist directory not found or empty"
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
- name: Run tests
run: bun test
deploy:
needs: build
runs-on: ubuntu-latest
environment: .env
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Use Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: Check downloaded artifacts
run: ls -R dist || echo "dist directory not found or empty after download"
- name: Check if secrets are set
run: |
echo "TOKEN is set: ${{ secrets.TOKEN != '' }}"
echo "CLIENT_ID is set: ${{ secrets.CLIENT_ID != '' }}"
echo "GUILD_ID is set: ${{ secrets.GUILD_ID != '' }}"
echo "ACCESS is set: ${{ secrets.ACCESS != '' }}"
echo "SUPABASE_URL is set: ${{ secrets.SUPABASE_URL != '' }}"
echo "SUPABASE_ANON is set: ${{ secrets.SUPABASE_ANON != '' }}"
echo "CANVAS_DOMAIN is set: ${{ secrets.CANVAS_DOMAIN != '' }}"
echo "CANVAS_DOMAIN is set: ${{ secrets.ENCRYPTION_KEY != '' }}"
- name: Deploy to production
run: bun run deploy
env:
TOKEN: ${{ secrets.TOKEN }}
CLIENT_ID: ${{ secrets.CLIENT_ID }}
GUILD_ID: ${{ secrets.GUILD_ID }}
ACCESS: ${{ secrets.ACCESS }}
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
SUPABASE_ANON: ${{ secrets.SUPABASE_ANON }}
CANVAS_DOMAIN: ${{ secrets.CANVAS_DOMAIN }}
ENCRYPTION_KEY: ${{ secrets.ENCRYPTION_KEY }}
commitlint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install commitlint
run: bun add -d @commitlint/cli @commitlint/config-conventional
- name: Print versions
run: |
git --version
bun --version
bunx commitlint --version
- name: Validate current commit (last commit) with commitlint
if: github.event_name == 'push'
run: bunx commitlint --from HEAD~1 --to HEAD --verbose
- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run: bunx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose