@@ -14,69 +14,71 @@ concurrency:
1414 cancel-in-progress : true
1515
1616jobs :
17- build-push :
17+ build-main :
1818 runs-on : ubuntu-latest
1919 steps :
2020 - name : Checkout
2121 uses : actions/checkout@v4
2222
23- - name : Build main Docker image
24- env :
25- owner : ${{ github.repository_owner }}
26- reponame : ${{ github.event.repository.name }}
27- run : |
28- docker build -t ghcr.io/${owner}/${reponame} .
29- docker tag ghcr.io/${owner}/${reponame}:latest ghcr.io/${owner}/${reponame}:${GITHUB_SHA::8}
23+ - name : Get commit SHA
24+ id : commit
25+ run : echo "sha=${GITHUB_SHA::8}" >> "$GITHUB_OUTPUT"
3026
31- - name : Build slim Docker images
32- env :
33- owner : ${{ github.repository_owner }}
34- reponame : ${{ github.event.repository.name }}
35- run : |
36- docker build --target=gnoland-slim -t ghcr.io/${owner}/${reponame}/gnoland-slim .
37- docker build --target=gnokey-slim -t ghcr.io/${owner}/${reponame}/gnokey-slim .
38- docker build --target=gno-slim -t ghcr.io/${owner}/${reponame}/gno-slim .
39- docker build --target=gnofaucet-slim -t ghcr.io/${owner}/${reponame}/gnofaucet-slim .
40- docker build --target=gnoweb-slim -t ghcr.io/${owner}/${reponame}/gnoweb-slim .
27+ - name : Set up Docker Buildx
28+ uses : docker/setup-buildx-action@v3
4129
42- docker tag ghcr.io/${owner}/${reponame}/gnoland-slim:latest ghcr.io/${owner}/${reponame}/gnoland-slim:${GITHUB_SHA::8}
43- docker tag ghcr.io/${owner}/${reponame}/gnokey-slim:latest ghcr.io/${owner}/${reponame}/gnokey-slim:${GITHUB_SHA::8}
44- docker tag ghcr.io/${owner}/${reponame}/gno-slim:latest ghcr.io/${owner}/${reponame}/gno-slim:${GITHUB_SHA::8}
45- docker tag ghcr.io/${owner}/${reponame}/gnofaucet-slim:latest ghcr.io/${owner}/${reponame}/gnofaucet-slim:${GITHUB_SHA::8}
46- docker tag ghcr.io/${owner}/${reponame}/gnoweb-slim:latest ghcr.io/${owner}/${reponame}/gnoweb-slim:${GITHUB_SHA::8}
47-
48- - name : List docker images
49- run : |
50- docker images | grep ghcr
51-
52- - name : Log in to GitHub Container Registry
53- if : (github.event_name != 'pull_request')
30+ - name : Login to GitHub Container Registry
5431 uses : docker/login-action@v3
32+ if : (github.event_name != 'pull_request')
5533 with :
5634 registry : ghcr.io
5735 username : ${{ github.actor }}
5836 password : ${{ secrets.GITHUB_TOKEN }}
37+
38+ - name : Build and push
39+ uses : docker/build-push-action@v3
40+ with :
41+ context : .
42+ platforms : linux/amd64,linux/arm64
43+ push : ${{ github.event_name != 'pull_request' }}
44+ tags : |
45+ ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest
46+ ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ steps.commit.outputs.sha }}
5947
60- - name : Publish images
61- if : (github.event_name != 'pull_request')
62- env :
63- owner : ${{ github.repository_owner }}
64- reponame : ${{ github.event.repository.name }}
65- run : |
66- docker push ghcr.io/${owner}/${reponame}:latest
67- docker push ghcr.io/${owner}/${reponame}:${GITHUB_SHA::8}
68-
69- docker push ghcr.io/${owner}/${reponame}/gnoland-slim:latest
70- docker push ghcr.io/${owner}/${reponame}/gnoland-slim:${GITHUB_SHA::8}
48+ build-slim :
49+ runs-on : ubuntu-latest
50+ strategy :
51+ matrix :
52+ target : [gnoland-slim, gnokey-slim, gno-slim, gnofaucet-slim, gnoweb-slim]
53+ steps :
54+ - name : Checkout
55+ uses : actions/checkout@v4
7156
72- docker push ghcr.io/${owner}/${reponame}/gnokey-slim:latest
73- docker push ghcr.io/${owner}/${reponame}/gnokey-slim:${GITHUB_SHA::8}
57+ - name : Get commit SHA
58+ id : commit
59+ run : echo "sha=${GITHUB_SHA::8}" >> "$GITHUB_OUTPUT"
7460
75- docker push ghcr.io/${owner}/${reponame}/gno-slim:latest
76- docker push ghcr.io/${owner}/${reponame}/gno-slim:${GITHUB_SHA::8}
61+ - name : Set up Docker Buildx
62+ uses : docker/setup-buildx-action@v3
7763
78- docker push ghcr.io/${owner}/${reponame}/gnofaucet-slim:latest
79- docker push ghcr.io/${owner}/${reponame}/gnofaucet-slim:${GITHUB_SHA::8}
64+ - name : Set up Docker Buildx
65+ uses : docker/setup-buildx-action@v3
8066
81- docker push ghcr.io/${owner}/${reponame}/gnoweb-slim:latest
82- docker push ghcr.io/${owner}/${reponame}/gnoweb-slim:${GITHUB_SHA::8}
67+ - name : Login to GitHub Container Registry
68+ uses : docker/login-action@v3
69+ if : (github.event_name != 'pull_request')
70+ with :
71+ registry : ghcr.io
72+ username : ${{ github.actor }}
73+ password : ${{ secrets.GITHUB_TOKEN }}
74+
75+ - name : Build and push
76+ uses : docker/build-push-action@v3
77+ with :
78+ context : .
79+ platforms : linux/amd64,linux/arm64
80+ target : ${{ matrix.target }}
81+ push : ${{ github.event_name != 'pull_request' }}
82+ tags : |
83+ ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}/${{ matrix.target }}:latest
84+ ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}/${{ matrix.target }}:${{ steps.commit.outputs.sha }}
0 commit comments