File tree Expand file tree Collapse file tree 1 file changed +23
-7
lines changed Expand file tree Collapse file tree 1 file changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -2,25 +2,41 @@ name: update docker image
2
2
3
3
on :
4
4
push :
5
+ branches :
6
+ - dev
7
+ - master
5
8
tags :
6
9
- ' v*.*.*'
7
10
8
11
jobs :
9
12
build :
10
13
runs-on : ubuntu-latest
11
14
steps :
12
- -
13
- name : Login to Docker Hub
15
+ - name : set docker image tag
16
+ run : |
17
+ echo "CREATE_IMAGE=true" >> $env:GITHUB_ENV
18
+ if [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
19
+ echo "IMAGE_TAG=dev" >> $env:GITHUB_ENV
20
+ elif [[ "${{ github.ref_type }}" == "tag" ]]; then
21
+ echo "IMAGE_TAG=${{ github.ref_name }}"
22
+ else
23
+ echo "CREATE_IMAGE=false" >> $env:GITHUB_ENV
24
+ fi
25
+
26
+ - name : Login to Docker Hub
14
27
uses : docker/login-action@v3
28
+ if : env.CREATE_IMAGE == 'true'
15
29
with :
16
30
username : ${{ vars.DOCKERHUB_USERNAME }}
17
31
password : ${{ secrets.DOCKERHUB_TOKEN }}
18
- -
19
- name : Set up Docker Buildx
32
+
33
+ - name : Set up Docker Buildx
20
34
uses : docker/setup-buildx-action@v3
21
- -
22
- name : Build and push
35
+ if : env.CREATE_IMAGE == 'true'
36
+
37
+ - name : Build and push
23
38
uses : docker/build-push-action@v6
39
+ if : env.CREATE_IMAGE == 'true'
24
40
with :
25
41
push : true
26
- tags : ${{ vars.DOCKERHUB_USERNAME }}/rdgen:latest
42
+ tags : ${{ vars.DOCKERHUB_USERNAME }}/${{ github.repository }}:${{ env.IMAGE_TAG }}
You can’t perform that action at this time.
0 commit comments