File tree 1 file changed +45
-0
lines changed
1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Build and Push Docker image
2
+
3
+ on :
4
+ push :
5
+ tags :
6
+ - ' v*' # Trigger workflow only on tags that start with 'v'
7
+
8
+ jobs :
9
+ build-and-push :
10
+ runs-on : ubuntu-latest
11
+ steps :
12
+ - name : Check out the repo
13
+ uses : actions/checkout@v2
14
+
15
+ - name : Set up Python
16
+ uses : actions/setup-python@v2
17
+ with :
18
+ python-version : ' 3.10'
19
+
20
+ - name : Install hatch
21
+ run : pip install hatch
22
+
23
+ - name : Extract version using Hatch
24
+ id : get_version
25
+ run : echo "VERSION=$(hatch version)" >> $GITHUB_ENV
26
+
27
+ - name : Log in to DockerHub
28
+ uses : docker/login-action@v1
29
+ with :
30
+ username : ${{ secrets.DOCKERHUB_USERNAME }}
31
+ password : ${{ secrets.DOCKERHUB_PASSWORD }}
32
+
33
+ - name : Set up Docker Buildx
34
+ uses : docker/setup-buildx-action@v1
35
+
36
+ - name : Build and push Docker image
37
+ uses : docker/build-push-action@v2
38
+ with :
39
+ context : .
40
+ file : ./Dockerfile
41
+ push : true
42
+ tags : zerealfu/fass:${{ env.VERSION }}
43
+
44
+ - name : Image digest
45
+ run : echo ${{ steps.docker_build.outputs.digest }}
You can’t perform that action at this time.
0 commit comments