-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (46 loc) · 1.34 KB
/
build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Build Docker Image
on:
push:
branches:
- main
paths:
- 'frontend/**'
- 'backend/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
path1:
- 'frontend/**'
path2:
- 'backend/**'
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push frontend
if: steps.filter.outputs.path1 == 'true'
uses: docker/build-push-action@v6
with:
build-args: |
NEXT_PUBLIC_API_BASE_URL=${{ secrets.NEXT_PUBLIC_API_BASE_URL }}
context: ./frontend
push: true
tags: |
z1yoon/nus-secondhand-market-frontend:${{ github.ref_name }}
z1yoon/nus-secondhand-market-frontend:${{ github.sha }}
- name: Build and push backend
if: steps.filter.outputs.path2 == 'true'
uses: docker/build-push-action@v6
with:
context: ./backend
push: true
tags: |
z1yoon/nus-secondhand-market-backend:${{ github.ref_name }}
z1yoon/nus-secondhand-market-backend:${{ github.sha }}