@@ -23,10 +23,11 @@ jobs:
23
23
runs-on : ubuntu-latest
24
24
25
25
steps :
26
- - uses : actions/checkout@v2
26
+ - name : Checkout code
27
+ uses : actions/checkout@v2
27
28
28
- - name : Run tests
29
- run : make
29
+ - name : Test build
30
+ run : make build
30
31
31
32
# Push image to GitHub Packages.
32
33
# See also https://docs.docker.com/docker-hub/builds/
42
43
packages : write
43
44
44
45
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
57
48
run : |
58
49
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
59
50
69
60
# Use Docker `latest` tag convention
70
61
[ "$VERSION" == "master" ] && VERSION=latest
71
62
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