File tree Expand file tree Collapse file tree 1 file changed +31
-14
lines changed Expand file tree Collapse file tree 1 file changed +31
-14
lines changed Original file line number Diff line number Diff line change 1
- name : Build Docker Image
1
+ name : Build and Push Docker Image
2
2
3
3
on :
4
4
push :
5
5
branches :
6
6
- main
7
7
tags :
8
- - ' v *'
8
+ - ' *'
9
9
10
10
jobs :
11
- build :
11
+ docker :
12
12
runs-on : ubuntu-latest
13
+ permissions :
14
+ contents : read
15
+ packages : write
16
+
13
17
steps :
14
- - uses : actions/checkout@v2
15
- - name : Build Docker image
16
- run : docker build . --file Dockerfile --tag my-image-name:$(git rev-parse --short HEAD)
17
- # Publish to DockerHUB. Necessary?
18
- # - name: Log in to DockerHub
19
- # uses: docker/login-action@v1
20
- # with:
21
- # username: ${{ secrets.DOCKER_USERNAME }}
22
- # password: ${{ secrets.DOCKER_PASSWORD }}
23
- # - name: Push Docker image
24
- # run: docker push my-image-name:$(git rev-parse --short HEAD)
18
+ - name : Check out the repo
19
+ uses : actions/checkout@v4
20
+
21
+ - name : Set up Docker Buildx
22
+ uses : docker/setup-buildx-action@v3
23
+
24
+ - name : Log in to GitHub Container Registry
25
+ uses : docker/login-action@v3
26
+ with :
27
+ registry : ghcr.io
28
+ username : ${{ github.repository_owner }}
29
+ password : ${{ secrets.CR_PAT }}
30
+
31
+ - name : Extract tag name
32
+ id : tag_name
33
+ run : echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
34
+
35
+ - name : Build and push Docker image
36
+ uses : docker/build-push-action@v5
37
+ with :
38
+ context : .
39
+ file : ./Dockerfile
40
+ push : true
41
+ tags : ghcr.io/${{ github.repository }}/kube-downscaler:${{ env.TAG_NAME }}
You can’t perform that action at this time.
0 commit comments