@@ -23,10 +23,11 @@ jobs:
2323 runs-on : ubuntu-latest
2424
2525 steps :
26- - uses : actions/checkout@v2
26+ - name : Checkout code
27+ uses : actions/checkout@v2
2728
28- - name : Run tests
29- run : make
29+ - name : Test build
30+ run : make build
3031
3132 # Push image to GitHub Packages.
3233 # See also https://docs.docker.com/docker-hub/builds/
4243 packages : write
4344
4445 steps :
45- - uses : actions/checkout@v2
46-
47- - name : Build app
48- run : make build
49-
50- - name : Build image
51- run : docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
52-
53- - name : Log into registry
54- run : echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
55-
56- - name : Push image
46+ - name : Set up environment
47+ id : setup
5748 run : |
5849 IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
5950
6960 # Use Docker `latest` tag convention
7061 [ "$VERSION" == "master" ] && VERSION=latest
7162
72- echo IMAGE_ID=$IMAGE_ID
73- echo VERSION=$VERSION
74-
75- docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
76- docker push $IMAGE_ID:$VERSION
63+ TAGS="${IMAGE_ID}:${VERSION}"
64+
65+ echo ::set-output name=tags::${TAGS}
66+
67+ - name : Checkout code
68+ uses : actions/checkout@v2
69+
70+ - name : Set up QEMU
71+ id : qemu
72+ uses : docker/setup-qemu-action@v1
73+ with :
74+ platforms : arm64
75+
76+ - name : Set up Docker Buildx
77+ id : buildx
78+ uses : docker/setup-buildx-action@v1
79+ with :
80+ install : true
81+
82+ - name : List available platforms
83+ run : echo ${{ steps.buildx.outputs.platforms }}
84+
85+ - name : Login to GitHub Container Registry
86+ uses : docker/login-action@v1
87+ with :
88+ registry : ghcr.io
89+ username : ${{ github.repository_owner }}
90+ password : ${{ secrets.GITHUB_TOKEN }}
91+
92+ - name : Build and push
93+ uses : docker/build-push-action@v2
94+ with :
95+ context : .
96+ file : ./Dockerfile
97+ platforms : linux/amd64,linux/arm64
98+ tags : ${{ steps.setup.outputs.tags }}
99+ push : true
0 commit comments