forked from ishaan1013/shadow
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (67 loc) · 2.03 KB
/
build.yml
File metadata and controls
83 lines (67 loc) · 2.03 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
name: Build and Test
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Enable Corepack
run: corepack enable
- name: Install dependencies
run: npm ci
- name: Install Turbo globally
run: npm install -g turbo
- name: Generate Prisma types
run: npm run generate
- name: Build workspace packages first
run: npm run build
- name: Run type checking
run: npm run check-types
- name: Run linting
run: npm run lint
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Container Registry
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push sidecar image
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: docker/build-push-action@v5
with:
context: .
file: apps/sidecar/Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}/shadow-sidecar:latest
ghcr.io/${{ github.repository }}/shadow-sidecar:${{ github.sha }}
platforms: linux/amd64
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts-${{ github.sha }}
path: |
apps/*/dist/
packages/*/dist/
packages/db/generated/
retention-days: 7
if-no-files-found: warn