1- name : CI
1+ name : CI / CD Pipeline for TaskNexus App
22
33on :
44 push :
1111 name : 🛠️ Setup
1212 runs-on : ubuntu-latest
1313 outputs :
14- cache-hit : ${{ steps.cache-node.outputs.cache-hit }}
14+ cache-key : ${{ steps.cache-node.outputs.cache-key }}
1515 steps :
1616 - name : Checkout code
1717 uses : actions/checkout@v4
@@ -40,19 +40,26 @@ jobs:
4040 needs : setup
4141 steps :
4242 - uses : actions/checkout@v4
43- - name : Restore Node modules cache
44- uses : actions/cache@v3
45- with :
46- path : ~/.npm
47- key : ${{ needs.setup.outputs.cache-hit }}
43+
4844 - name : Setup Node.js
4945 uses : actions/setup-node@v4
5046 with :
5147 node-version : 18
48+
49+ - name : Restore cache
50+ uses : actions/cache@v3
51+ with :
52+ path : ~/.npm
53+ key : ${{ needs.setup.outputs.cache-key }}
54+ restore-keys : |
55+ ${{ runner.os }}-node-
56+
5257 - name : Install dependencies
5358 run : npm ci
59+
5460 - name : Run Prettier
5561 run : npm run format
62+
5663 - name : Run ESLint
5764 run : npm run lint
5865
@@ -62,12 +69,15 @@ jobs:
6269 needs : lint
6370 steps :
6471 - uses : actions/checkout@v4
72+
6573 - name : Setup Node.js
6674 uses : actions/setup-node@v4
6775 with :
6876 node-version : 18
77+
6978 - name : Install dependencies
7079 run : npm ci
80+
7181 - name : Run Jest
7282 run : npm test -- --ci --silent
7383
@@ -77,16 +87,20 @@ jobs:
7787 needs : test
7888 steps :
7989 - uses : actions/checkout@v4
90+
8091 - name : Setup Node.js
8192 uses : actions/setup-node@v4
8293 with :
8394 node-version : 18
95+
8496 - name : Install dependencies
8597 run : npm ci
98+
8699 - name : Run coverage
87100 run : npm run test:coverage -- --ci
101+
88102 - name : Upload coverage report
89- uses : actions/upload-artifact@v3
103+ uses : actions/upload-artifact@v4
90104 with :
91105 name : coverage-report
92106 path : coverage/
@@ -97,36 +111,42 @@ jobs:
97111 needs : coverage
98112 steps :
99113 - uses : actions/checkout@v4
114+
100115 - name : Setup Node.js
101116 uses : actions/setup-node@v4
102117 with :
103118 node-version : 18
119+
104120 - name : Install dependencies
105121 run : npm ci
122+
106123 - name : Compile TS → build/
107124 run : npx tsc --project tsconfig.json --outDir build
125+
108126 - name : Upload build artifacts
109- uses : actions/upload-artifact@v3
127+ uses : actions/upload-artifact@v4
110128 with :
111129 name : ts-build
112130 path : build/
113131
114132 docker :
115- name : 🐳 Docker → GHCR
133+ name : 🐳 Docker → GHCR (Node)
116134 runs-on : ubuntu-latest
117135 needs : ts-build
118136 permissions :
119137 contents : read
120138 packages : write
121139 steps :
122140 - uses : actions/checkout@v4
141+
123142 - name : Log in to GHCR
124143 uses : docker/login-action@v3
125144 with :
126145 registry : ghcr.io
127146 username : ${{ github.actor }}
128147 password : ${{ secrets.GITHUB_TOKEN }}
129- - name : Build & push image
148+
149+ - name : Build & push Node image
130150 uses : docker/build-push-action@v5
131151 with :
132152 context : .
@@ -136,20 +156,50 @@ jobs:
136156 ghcr.io/${{ github.repository_owner }}/task-manager-reactnative:${{ github.sha }}
137157 ghcr.io/${{ github.repository_owner }}/task-manager-reactnative:latest
138158
159+ docker-ruby :
160+ name : 🐳 Docker → GHCR (Ruby)
161+ runs-on : ubuntu-latest
162+ needs : ts-build
163+ permissions :
164+ contents : read
165+ packages : write
166+ steps :
167+ - uses : actions/checkout@v4
168+
169+ - name : Log in to GHCR
170+ uses : docker/login-action@v3
171+ with :
172+ registry : ghcr.io
173+ username : ${{ github.actor }}
174+ password : ${{ secrets.GITHUB_TOKEN }}
175+
176+ - name : Build & push Ruby image
177+ uses : docker/build-push-action@v5
178+ with :
179+ context : .
180+ file : ./ruby/Dockerfile
181+ push : true
182+ tags : |
183+ ghcr.io/${{ github.repository_owner }}/task-manager-reactnative-ruby:${{ github.sha }}
184+ ghcr.io/${{ github.repository_owner }}/task-manager-reactnative-ruby:latest
185+
139186 deploy :
140187 name : 🚀 Deploy
141188 runs-on : ubuntu-latest
142- needs : docker
189+ needs :
190+ - docker
191+ - docker-ruby
143192 steps :
144193 - name : Checkout code
145194 uses : actions/checkout@v4
195+
146196 - name : Decode & run deploy script
147197 env :
148198 DEPLOY_B64 : ${{ secrets.DEPLOY }}
149199 run : |
150200 echo "$DEPLOY_B64" | base64 --decode > deploy.sh
151201 chmod +x deploy.sh
152202 ./deploy.sh
203+
153204 - name : Announce deployment
154205 run : echo "✅ Deployment complete!"
155-
0 commit comments