-
Notifications
You must be signed in to change notification settings - Fork 3
57 lines (47 loc) · 1.36 KB
/
server.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
name: Docker Image CI for GHCR for Bridge Server
on:
push:
branches:
- main
paths:
- "server/**" # Only trigger the workflow for changes in the server directory
jobs:
build_and_publish:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: |
corepack enable
pnpm install
working-directory: server
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
run: |
docker login --username "${{ secrets.GH_USER }}" --password "${{ secrets.GH_TOKEN }}" ghcr.io
- name: Run Docker build and push with pnpm script
run: |
pnpm docker:build && pnpm docker:push
working-directory: server
deploy:
needs: build_and_publish
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Set up kubectl
uses: azure/setup-kubectl@v3
with:
version: v1.30.6
- name: Deploy to Kubernetes
env:
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG }}
run: |
pnpm k8s:apply
working-directory: server