@@ -3,9 +3,7 @@ name: CI/CD Pipeline
3
3
on :
4
4
push :
5
5
branches : [main, develop]
6
- tags : ['v*']
7
- pull_request :
8
- branches : [main, develop]
6
+ tags : ["v*"]
9
7
10
8
env :
11
9
REGISTRY : ghcr.io
@@ -19,22 +17,22 @@ jobs:
19
17
steps :
20
18
- name : Checkout repository
21
19
uses : actions/checkout@v4
22
-
20
+
23
21
- name : Setup Node.js
24
22
uses : actions/setup-node@v4
25
23
with :
26
- node-version : ' 18 '
27
- cache : ' npm'
28
-
24
+ node-version : " 18 "
25
+ cache : " npm"
26
+
29
27
- name : Install dependencies
30
28
run : npm ci
31
-
29
+
32
30
- name : Run ESLint
33
31
run : npm run lint
34
-
32
+
35
33
- name : Run TypeScript checks
36
34
run : npm run type-check
37
-
35
+
38
36
# TODO: Uncomment when tests are added
39
37
# - name: Run Tests
40
38
# run: npm test
@@ -48,38 +46,38 @@ jobs:
48
46
steps :
49
47
- name : Checkout repository
50
48
uses : actions/checkout@v4
51
-
49
+
52
50
- name : Setup Node.js
53
51
uses : actions/setup-node@v4
54
52
with :
55
- node-version : ' 18 '
56
- cache : ' npm'
57
-
53
+ node-version : " 18 "
54
+ cache : " npm"
55
+
58
56
- name : Install dependencies
59
57
run : npm ci
60
-
58
+
61
59
- name : Generate build cache key
62
60
id : build-cache
63
61
run : echo "key=build-${{ hashFiles('**/*.ts', '**/*.tsx', '**/*.js', 'package-lock.json') }}" >> $GITHUB_OUTPUT
64
-
62
+
65
63
- name : Check build cache
66
64
id : check-build-cache
67
65
uses : actions/cache@v4
68
66
with :
69
67
path : .next
70
68
key : ${{ steps.build-cache.outputs.key }}
71
-
69
+
72
70
- name : Build application
73
71
if : steps.check-build-cache.outputs.cache-hit != 'true'
74
72
run : npm run build
75
-
73
+
76
74
- name : Cache build output
77
75
if : steps.check-build-cache.outputs.cache-hit != 'true'
78
76
uses : actions/cache@v4
79
77
with :
80
78
path : .next
81
79
key : ${{ steps.build-cache.outputs.key }}
82
-
80
+
83
81
- name : Upload build artifacts
84
82
uses : actions/upload-artifact@v4
85
83
with :
@@ -102,23 +100,23 @@ jobs:
102
100
steps :
103
101
- name : Checkout repository
104
102
uses : actions/checkout@v4
105
-
103
+
106
104
- name : Download build artifacts
107
105
uses : actions/download-artifact@v4
108
106
with :
109
107
name : build-output
110
108
path : .
111
-
109
+
112
110
- name : Set up Docker Buildx
113
111
uses : docker/setup-buildx-action@v3
114
-
112
+
115
113
- name : Login to Container Registry
116
114
uses : docker/login-action@v3
117
115
with :
118
116
registry : ${{ env.REGISTRY }}
119
117
username : ${{ github.actor }}
120
118
password : ${{ secrets.GITHUB_TOKEN }}
121
-
119
+
122
120
- name : Extract metadata for Docker
123
121
id : meta
124
122
uses : docker/metadata-action@v5
@@ -129,7 +127,7 @@ jobs:
129
127
type=semver,pattern={{version}}
130
128
type=sha,format=short
131
129
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
132
-
130
+
133
131
- name : Build and push Docker image
134
132
uses : docker/build-push-action@v5
135
133
with :
0 commit comments