File tree Expand file tree Collapse file tree 1 file changed +53
-0
lines changed
Expand file tree Collapse file tree 1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change 1+ name : CI/CD Pipeline
2+
3+ on :
4+ push :
5+ branches : [main]
6+ pull_request :
7+ branches : [main]
8+
9+ jobs :
10+ build-and-push :
11+ runs-on : ubuntu-latest
12+
13+ steps :
14+ # Step 1: Checkout code
15+ - name : Checkout repo
16+ uses : actions/checkout@v3
17+
18+ # Step 2: Set up Node.js
19+ - name : Set up Node.js
20+ uses : actions/setup-node@v3
21+ with :
22+ node-version : 20
23+
24+ # Step 3: Install pnpm
25+ - name : Install pnpm
26+ run : npm install -g pnpm
27+
28+ # Step 4: Install dependencies
29+ - name : Install dependencies
30+ run : pnpm install
31+
32+ # Step 5: Run tests (optional, skip if none)
33+ - name : Run tests
34+ run : pnpm test || echo "No tests configured yet"
35+
36+ # Step 6: Build TypeScript
37+ - name : Build TypeScript
38+ run : pnpm exec tsc
39+
40+ # Step 7: Log in to Docker Hub
41+ - name : Log in to Docker Hub
42+ uses : docker/login-action@v2
43+ with :
44+ username : ${{ secrets.DOCKER_USERNAME }}
45+ password : ${{ secrets.DOCKER_ACCESS_TOKEN }}
46+
47+ # Step 8: Build Docker image
48+ - name : Build Docker image
49+ run : docker build -t raone1422g/restapi:v1.0 .
50+
51+ # Step 9: Push Docker image
52+ - name : Push Docker image
53+ run : docker push raone1422g/restapi:v1.0
You can’t perform that action at this time.
0 commit comments