File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ name: miniCRM workflow
22
33on :
44 push :
5- branches : [ dev ]
5+ branches :
6+ - ' **'
67
78jobs :
89 lint :
@@ -34,10 +35,13 @@ jobs:
3435 run : |
3536 flake8 . --count --statistics --show-source
3637
37- build_and_push_to_docker_hub :
38- name : miniCRM Push Docker Image to Docker Hub
38+ push_branch_dev_to_docker_hub :
39+ name : Build and Push Docker (dev)
3940 runs-on : ubuntu-latest
4041 needs : lint
42+
43+ if : github.ref == 'refs/heads/dev'
44+
4145 steps :
4246 - name : Check out the repo
4347 uses : actions/checkout@v4
5660 push : true
5761 tags : |
5862 dmsn/minicrm:dev
63+
64+ push_branch_main_to_docker_hub :
65+ name : Build and Push Docker (prod)
66+ runs-on : ubuntu-latest
67+ needs : lint
68+
69+ if : github.ref == 'refs/heads/main'
70+
71+ steps :
72+ - name : Check out the repo
73+ uses : actions/checkout@v4
74+
75+ - name : Setup Docker Buildx
76+ uses : docker/setup-buildx-action@v3
77+
78+ - name : Login to Docker
79+ uses : docker/login-action@v3
80+ with :
81+ username : ${{ secrets.DOCKER_USERNAME }}
82+ password : ${{ secrets.DOCKER_PASSWORD }}
83+ - name : Push to Docker Hub
84+ uses : docker/build-push-action@v5
85+ with :
86+ push : true
87+ tags : |
88+ dmsn/minicrm:prod
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ services:
1010 env_file :
1111 - ./.env
1212 backend :
13- image : dmsn/minicrm:latest
13+ image : dmsn/minicrm:${{IMAGE_TAG}}
1414 restart : always
1515 depends_on :
1616 - db
You can’t perform that action at this time.
0 commit comments