-
Notifications
You must be signed in to change notification settings - Fork 2
109 lines (88 loc) · 2.75 KB
/
main.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
107
108
109
name: CI
on:
push:
branches: [trunk]
pull_request:
branches: [trunk]
env:
GIT_LFS_CACHE_DIR: '${{ github.workspace }}/git-lfs-cache'
jobs:
build-and-test:
runs-on: self-hosted
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
TURBO_REMOTE_ONLY: true
steps:
- uses: actions/checkout@v3
- name: Restore Git LFS cache
uses: actions/cache@v2
with:
path: '${{ env.GIT_LFS_CACHE_DIR }}'
key: "${{ runner.os }}-git-lfs-${{ hashFiles('**/lfs/*') }}"
restore-keys: |
${{ runner.os }}-git-lfs-
- name: Git LFS checkout
run: git lfs checkout
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install pnpm
run: npm i -g pnpm turbo
- name: Cache pnpm modules
uses: actions/cache@v2
with:
path: ~/.pnpm-store/v3
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Setup prisma
run: turbo db:generate
- name: Build
run: pnpm run build
# - name: Test
# run: pnpm run test
#
# - uses: codecov/codecov-action@v3
# with:
# files: ./packages/osiris/coverage/lcov.info #, ...
docker:
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- name: Restore Git LFS cache
uses: actions/cache@v2
with:
path: '${{ env.GIT_LFS_CACHE_DIR }}'
key: "${{ runner.os }}-git-lfs-${{ hashFiles('**/lfs/*') }}"
restore-keys: |
${{ runner.os }}-git-lfs-
- name: Git LFS checkout
run: git lfs checkout
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 18
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
with:
context: .
file: ./apps/server/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}