This repository was archived by the owner on Nov 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Docker
2
+
3
+ on :
4
+ push :
5
+ # Publish `develop` as Docker `latest` image.
6
+ branches :
7
+ - develop
8
+
9
+ # Publish `v1.2.3` tags as releases.
10
+ tags :
11
+ - v*
12
+
13
+ # Run tests for any PRs.
14
+ pull_request :
15
+
16
+ env :
17
+ IMAGE_NAME : muhammetaliakbay/orbit-db-http-api
18
+
19
+ jobs :
20
+ # Push image to GitHub Packages.
21
+ # See also https://docs.docker.com/docker-hub/builds/
22
+ push :
23
+ runs-on : ubuntu-latest
24
+ if : github.event_name == 'push'
25
+
26
+ steps :
27
+ - uses : actions/checkout@v2
28
+
29
+ - name : Build image
30
+ run : docker build . --file Dockerfile --tag $IMAGE_NAME
31
+
32
+ - name : Log into registry
33
+ run : echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
34
+
35
+ - name : Push image
36
+ run : |
37
+ IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME
38
+
39
+ # Change all uppercase to lowercase
40
+ IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
41
+
42
+ # Strip git ref prefix from version
43
+ VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
44
+
45
+ # Strip "v" prefix from tag name
46
+ [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
47
+
48
+ # Use Docker `latest` tag convention
49
+ [ "$VERSION" == "develop" ] && VERSION=latest
50
+
51
+ echo IMAGE_ID=$IMAGE_ID
52
+ echo VERSION=$VERSION
53
+
54
+ docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
55
+ docker push $IMAGE_ID:$VERSION
You can’t perform that action at this time.
0 commit comments