File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ name : DockerBuildAndPush
2+
3+ on :
4+ push :
5+ branches :
6+ - master
7+ - developement
8+ - ptb-async
9+
10+ env :
11+ IMAGE_NAME : transcriberbot
12+
13+ jobs :
14+ push :
15+ runs-on : ubuntu-latest
16+ if : github.event_name == 'push'
17+
18+ steps :
19+ - uses : actions/checkout@v2
20+
21+ - name : Login to ghcr registry
22+ run : echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
23+
24+ - name : Build image
25+ run : docker build . --file Dockerfile --tag $IMAGE_NAME
26+
27+ - name : Push image
28+ run : |
29+ IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
30+ # Change all uppercase to lowercase
31+ IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
32+ # Strip git ref prefix from version
33+ VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
34+ # Strip "v" prefix from tag name
35+ [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
36+ # Use Docker `latest` tag convention
37+ [ "$VERSION" == "master" ] && VERSION=latest
38+ echo IMAGE_ID=$IMAGE_ID
39+ echo VERSION=$VERSION
40+ docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
41+ docker push $IMAGE_ID:$VERSION
You can’t perform that action at this time.
0 commit comments