File tree 1 file changed +53
-0
lines changed
1 file changed +53
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Docker
2
+
3
+ on :
4
+ push :
5
+ # Publish `main` as Docker `latest` image.
6
+ branches :
7
+ - main
8
+
9
+ # Publish `1.2.3` tags as releases.
10
+ tags :
11
+ - ' *'
12
+
13
+ env :
14
+ # TODO: Change variable to your image's name.
15
+ IMAGE_NAME : aws-ecs-eds
16
+
17
+ jobs :
18
+ # Push image to GitHub Packages.
19
+ # See also https://docs.docker.com/docker-hub/builds/
20
+ push :
21
+ runs-on : ubuntu-latest
22
+
23
+
24
+ steps :
25
+ - uses : actions/checkout@v2
26
+
27
+ - name : Build image
28
+ run : docker build . --file Dockerfile --tag $IMAGE_NAME
29
+
30
+ - name : Login to DockerHub Registry
31
+ run : echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
32
+
33
+ - name : Push image
34
+ run : |
35
+ IMAGE_ID=boostchicken/$IMAGE_NAME
36
+
37
+ # Change all uppercase to lowercase
38
+ IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
39
+
40
+ # Strip git ref prefix from version
41
+ VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
42
+
43
+ # Strip "v" prefix from tag name
44
+ [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
45
+
46
+ # Use Docker `latest` tag convention
47
+ [ "$VERSION" == "main" ] && VERSION=latest
48
+
49
+ echo IMAGE_ID=$IMAGE_ID
50
+ echo VERSION=$VERSION
51
+
52
+ docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
53
+ docker push $IMAGE_ID:$VERSION
You can’t perform that action at this time.
0 commit comments