-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (59 loc) · 2.17 KB
/
deploy.yml
File metadata and controls
72 lines (59 loc) · 2.17 KB
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
name: Deploy webhouse.app
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
jobs:
check:
name: Lint & Typecheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build packages
run: pnpm build --filter='!@webhouse/cms-admin'
- name: Typecheck
run: pnpm lint
- name: Run tests
run: pnpm test:run || echo "⚠️ Tests with native modules skipped on CI"
deploy:
name: Deploy to Fly.io
needs: check
runs-on: ubuntu-latest
concurrency:
group: deploy-webhouse-app
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
- name: Deploy to Fly.io
run: flyctl deploy --remote-only --build-arg NEXT_PUBLIC_UPMETRICS_DSN="${{ vars.NEXT_PUBLIC_UPMETRICS_DSN }}"
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
- name: Notify Discord
if: always()
run: |
STATUS="${{ job.status }}"
if [ "$STATUS" = "success" ]; then
COLOR=3066993
EMOJI="✅"
MSG="**webhouse.app deployed** to production"
else
COLOR=15158332
EMOJI="❌"
MSG="**webhouse.app deploy failed**"
fi
COMMIT_MSG=$(git log -1 --pretty=format:'%s' HEAD)
ACTOR="${{ github.actor }}"
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
curl -s -X POST "${{ secrets.DEPLOY_DISCORD_WEBHOOK }}" \
-H "Content-Type: application/json" \
-d "{\"embeds\":[{\"title\":\"$EMOJI $MSG\",\"description\":\"$COMMIT_MSG\",\"color\":$COLOR,\"fields\":[{\"name\":\"Site\",\"value\":\"[webhouse.app](https://webhouse.app)\",\"inline\":true},{\"name\":\"Triggered by\",\"value\":\"$ACTOR\",\"inline\":true},{\"name\":\"Run\",\"value\":\"[View]($RUN_URL)\",\"inline\":true}]}]}" || true