|
1 | 1 | name: Frontend CI/CD |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - branches: [main] |
6 | | - paths: |
7 | | - - "front-end/**" |
| 4 | + push: |
| 5 | + branches: [main] |
8 | 6 |
|
9 | 7 | jobs: |
10 | | - build-frontend: |
11 | | - runs-on: ubuntu-latest |
12 | | - defaults: |
13 | | - run: |
14 | | - working-directory: front-end |
15 | | - steps: |
16 | | - - name: Checkout code |
17 | | - uses: actions/checkout@v4 |
18 | | - |
19 | | - - name: Setup Node.js |
20 | | - uses: actions/setup-node@v4 |
21 | | - with: |
22 | | - node-version: "24.8.0" |
23 | | - cache: "npm" |
24 | | - |
25 | | - - name: Install dependencies |
26 | | - run: npm install |
27 | | - |
28 | | - - name: Build frontend |
29 | | - run: npm run build |
30 | | - |
31 | | - - name: Upload build artifact |
32 | | - uses: actions/upload-artifact@v4 |
33 | | - with: |
34 | | - name: frontend-build |
35 | | - path: dist/ |
36 | | - |
37 | | - deploy-frontend: |
38 | | - runs-on: ubuntu-latest |
39 | | - needs: build-frontend |
40 | | - steps: |
41 | | - - name: Checkout code |
42 | | - uses: actions/checkout@v4 |
43 | | - |
44 | | - - name: Download build artifact |
45 | | - uses: actions/download-artifact@v4 |
46 | | - with: |
47 | | - name: frontend-build |
48 | | - path: dist/ |
49 | | - |
50 | | - - name: Log in to Docker Hub |
51 | | - uses: docker/login-action@v3 |
52 | | - with: |
53 | | - username: ${{ secrets.DOCKER_HUB_USERNAME }} |
54 | | - password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} |
55 | | - |
56 | | - - name: Build Docker image |
57 | | - uses: docker/build-push-action@v5 |
58 | | - with: |
59 | | - context: ./front-end |
60 | | - file: ./front-end/Dockerfile |
61 | | - push: true |
62 | | - tags: ${{ secrets.DOCKER_HUB_USERNAME }}/frontend-aws-integration:latest |
| 8 | + build-frontend: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + defaults: |
| 11 | + run: |
| 12 | + working-directory: front-end |
| 13 | + steps: |
| 14 | + - name: Checkout code |
| 15 | + uses: actions/checkout@v4 |
| 16 | + |
| 17 | + - name: Setup Node.js |
| 18 | + uses: actions/setup-node@v4 |
| 19 | + with: |
| 20 | + node-version: "24.8.0" |
| 21 | + cache: "npm" |
| 22 | + |
| 23 | + - name: Install dependencies |
| 24 | + run: npm install |
| 25 | + |
| 26 | + - name: Build frontend |
| 27 | + run: npm run build |
| 28 | + |
| 29 | + - name: Upload build artifact |
| 30 | + uses: actions/upload-artifact@v4 |
| 31 | + with: |
| 32 | + name: frontend-build |
| 33 | + path: dist/ |
| 34 | + |
| 35 | + deploy-frontend: |
| 36 | + runs-on: ubuntu-latest |
| 37 | + needs: build-frontend |
| 38 | + steps: |
| 39 | + - name: Checkout code |
| 40 | + uses: actions/checkout@v4 |
| 41 | + |
| 42 | + - name: Download build artifact |
| 43 | + uses: actions/download-artifact@v4 |
| 44 | + with: |
| 45 | + name: frontend-build |
| 46 | + path: dist/ |
| 47 | + |
| 48 | + - name: Log in to Docker Hub |
| 49 | + uses: docker/login-action@v3 |
| 50 | + with: |
| 51 | + username: ${{ secrets.DOCKER_HUB_USERNAME }} |
| 52 | + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} |
| 53 | + |
| 54 | + - name: Build Docker image |
| 55 | + uses: docker/build-push-action@v5 |
| 56 | + with: |
| 57 | + context: ./front-end |
| 58 | + file: ./front-end/Dockerfile |
| 59 | + push: true |
| 60 | + tags: ${{ secrets.DOCKER_HUB_USERNAME }}/frontend-aws-integration:latest |
0 commit comments