-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (84 loc) · 2.21 KB
/
ci-cd.yml
File metadata and controls
102 lines (84 loc) · 2.21 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
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
name: CI/CD
on:
pull_request:
push:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
ci:
name: CI
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.8
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Typecheck
run: bun run typecheck
- name: Run tests
run: bun test
- name: Build deploy image
run: docker build -t anchr:${{ github.sha }} .
deploy-infra:
name: Deploy ${{ matrix.app }}
needs: ci
runs-on: ubuntu-latest
timeout-minutes: 30
if: >-
${{
github.event_name == 'workflow_dispatch' ||
(github.event_name == 'push' &&
github.ref == format('refs/heads/{0}', github.event.repository.default_branch))
}}
concurrency:
group: fly-${{ matrix.app }}
cancel-in-progress: true
permissions:
contents: read
environment:
name: production
strategy:
fail-fast: false
matrix:
include:
- app: relay
config: fly.relay.toml
- app: blossom
config: fly.blossom.toml
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Flyctl
uses: superfly/flyctl-actions/setup-flyctl@master
- name: Deploy ${{ matrix.app }}
run: flyctl deploy --remote-only --config ${{ matrix.config }}
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
deploy-app:
name: Deploy Anchr App
needs: deploy-infra
runs-on: ubuntu-latest
timeout-minutes: 30
concurrency:
group: fly-production
cancel-in-progress: true
permissions:
contents: read
environment:
name: production
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Flyctl
uses: superfly/flyctl-actions/setup-flyctl@master
- name: Deploy
run: flyctl deploy --remote-only --config fly.toml
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}