File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : docker-image
2
+
3
+ on :
4
+ push :
5
+ tags :
6
+ - ' *.*.*'
7
+ # on:
8
+ # pull_request:
9
+ # release:
10
+ # push:
11
+ # branches:
12
+ # - 'main'
13
+
14
+ jobs :
15
+
16
+ build :
17
+
18
+ runs-on : ubuntu-latest
19
+
20
+ steps :
21
+ - uses : actions/checkout@v2
22
+
23
+ - name : Build image
24
+ run : docker build --platform linux/amd64 -t myimage .
25
+
26
+ - name : Log into registry
27
+ run : echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
28
+
29
+ - name : Push image
30
+ run : |
31
+ IMAGE_ID=ghcr.io/${{ github.repository }}
32
+
33
+ # Change all uppercase to lowercase
34
+ IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
35
+
36
+ VERSION=latest
37
+ if [[ $GITHUB_REF == refs/tags/* ]]; then
38
+ VERSION=${GITHUB_REF#refs/tags/}
39
+ fi
40
+
41
+ docker tag myimage $IMAGE_ID:$VERSION
42
+ docker push $IMAGE_ID:$VERSION
You can’t perform that action at this time.
0 commit comments