@@ -17,39 +17,34 @@ jobs:
1717 uses : actions/setup-node@v1
1818 with :
1919 node-version : 12
20+
2021 - name : yarn install
2122 run : yarn install
2223 - name : build
2324 run : yarn run build
2425 - name : lint
2526 run : yarn run lint
26- - name : Build image
27+
28+ - name : Set up Docker Buildx
2729 if : contains(github.ref, 'master')
28- run : docker build . --file Dockerfile --tag $IMAGE_NAME
29-
30- - name : Log into registry
30+ uses : docker/setup-buildx-action@v1
31+
32+ - name : Login to Github Container Registry
3133 if : contains(github.ref, 'master')
32- run : echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
33-
34- - name : Push image
34+ uses : docker/login-action@v1
35+ with :
36+ registry : ghcr.io
37+ username : ${{ github.repository_owner }}
38+ password : ${{ secrets.GHCR_TOKEN }}
39+
40+ - name : Build and push
3541 if : contains(github.ref, 'master')
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" == "master" ] && 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
42+ uses : docker/build-push-action@v2
43+ with :
44+ context : .
45+ file : ./Dockerfile
46+ push : true
47+ cache-from : type=registry,ref=ghcr.io/typescript-community/bot:latest
48+ cache-to : type=inline
49+ tags : |
50+ ghcr.io/typescript-community/bot:latest
0 commit comments