Skip to content

Commit e707965

Browse files
committed
chore(ci): update GitHub Actions workflow
- Upgrade actions/checkout to v4 - Upgrade pnpm/action-setup to v4 - Add Docker build job using buildx and GHCR - Use docker/login-action and build-push-action for publishing - Ignore changes to Markdown and docs in CI triggers
1 parent d140e9d commit e707965

File tree

1 file changed

+39
-16
lines changed

1 file changed

+39
-16
lines changed

.github/workflows/ci.yml

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@ name: BrainBytes CI
33
on:
44
push:
55
branches: [main, develop]
6+
paths-ignore:
7+
- "**.md"
8+
- "docs/**"
69
pull_request:
710
branches: [main, develop]
11+
paths-ignore:
12+
- "**.md"
13+
- "docs/**"
814
workflow_dispatch:
915

1016
jobs:
@@ -14,21 +20,15 @@ jobs:
1420

1521
steps:
1622
- name: Check out repository
17-
uses: actions/checkout@v2
23+
uses: actions/checkout@v4
1824

1925
- name: Install pnpm and Node.js
20-
uses: pnpm/action-setup@v2
26+
uses: pnpm/action-setup@v4
2127
with:
2228
version: "10.10.0"
2329
node-version: "24.1.0"
2430
cache: "pnpm"
2531

26-
# - name: Setup Node.js
27-
# uses: actions/setup-node@v2
28-
# with:
29-
# node-version: "24.1.0"
30-
# cache: "pnpm"
31-
3232
- name: Install dependencies
3333
working-directory: ./src
3434
run: pnpm install --no-frozen-lockfile
@@ -48,25 +48,48 @@ jobs:
4848

4949
steps:
5050
- name: Check out repository
51-
uses: actions/checkout@v2
51+
uses: actions/checkout@v4
5252

5353
- name: Install pnpm and Node.js
54-
uses: pnpm/action-setup@v2
54+
uses: pnpm/action-setup@v4
5555
with:
5656
version: "10.10.0"
5757
node-version: "24.1.0"
5858
cache: "pnpm"
5959

60-
# - name: Setup Node.js
61-
# uses: actions/setup-node@v2
62-
# with:
63-
# node-version: "24.1.0"
64-
# cache: "pnpm"
65-
6660
- name: Install dependencies
6761
working-directory: ./src
6862
run: pnpm install --no-frozen-lockfile
6963

7064
- name: Run backend tests
7165
working-directory: ./src
7266
run: pnpm test
67+
68+
build:
69+
name: Build Docker Image
70+
needs: ["lint", "test"]
71+
runs-on: ubuntu-latest
72+
environment: GitHub actions
73+
74+
steps:
75+
- name: Check out repository
76+
uses: actions/checkout@v4
77+
78+
- name: Set up Docker Buildx
79+
uses: docker/setup-buildx-action@v3
80+
81+
- name: Log in to GHCR
82+
uses: docker/login-action@v3
83+
with:
84+
registry: ghcr.io
85+
username: ${{ github.actor }}
86+
password: ${{ secrets.GITHUB_TOKEN }}
87+
88+
- name: Build and push Image
89+
uses: docker/build-push-action@v4
90+
with:
91+
context: ./src
92+
push: true
93+
tags: ghcr.io/${{ github.repository_owner }}-api:latest
94+
cache-from: type=gha
95+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)