Skip to content

Commit ae88374

Browse files
committed
Merge branch 'develop' of github.com:ergoplatform/oracle-core into decimals
2 parents 7273c45 + 4ac8059 commit ae88374

File tree

1 file changed

+61
-27
lines changed

1 file changed

+61
-27
lines changed
Lines changed: 61 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
name: Cross-Compile Docker Build and Push
22

33
on:
4-
pull_request:
5-
types:
6-
- opened
7-
- synchronize
8-
- closed
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
env:
9+
REGISTRY_IMAGE: ergoplatform/oracle-core
910

1011
jobs:
1112
build:
@@ -23,45 +24,78 @@ jobs:
2324
uses: actions/checkout@v3
2425

2526
- name: Set up Docker Buildx
26-
uses: docker/setup-buildx-action@v1
27+
uses: docker/setup-buildx-action@v2
2728

2829
- name: Generate Docker metadata
2930
id: metadata
30-
uses: docker/metadata-action@v3
31+
uses: docker/metadata-action@v4
3132
with:
32-
images: greenden/oracle-core
33-
tags: |
34-
type=ref,event=tag
35-
- name: Build images
36-
uses: docker/build-push-action@v3
33+
images: ${{ env.REGISTRY_IMAGE }}
34+
35+
- name: Login to DockerHub
36+
uses: docker/login-action@v2
37+
with:
38+
username: ${{ secrets.DOCKERHUB_USERNAME }}
39+
password: ${{ secrets.DOCKERHUB_TOKEN }}
40+
41+
- name: Build and push by digest
42+
id: build
43+
uses: docker/build-push-action@v4
3744
with:
3845
context: .
3946
platforms: ${{ matrix.platform }}
40-
tags: ${{ steps.metadata.outputs.tags }}
47+
labels: ${{ steps.metadata.outputs.labels }}
48+
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
4149
build-args: |
4250
TARGETPLATFORM=${{ matrix.platform }}
4351
CCARCH=${{ matrix.ccarch }}
44-
push: false
45-
load: true
46-
47-
push:
52+
53+
- name: Export digest
54+
run: |
55+
mkdir -p /tmp/digests
56+
digest="${{ steps.build.outputs.digest }}"
57+
touch "/tmp/digests/${digest#sha256:}"
58+
59+
- name: Upload digest
60+
uses: actions/upload-artifact@v3
61+
with:
62+
name: digests
63+
path: /tmp/digests/*
64+
if-no-files-found: error
65+
retention-days: 1
66+
67+
merge:
4868
needs: build
4969
runs-on: ubuntu-latest
5070
steps:
71+
- name: Download digests
72+
uses: actions/download-artifact@v3
73+
with:
74+
name: digests
75+
path: /tmp/digests
76+
5177
- name: Set up Docker Buildx
52-
uses: docker/setup-buildx-action@v1
53-
78+
uses: docker/setup-buildx-action@v2
79+
80+
- name: Generate Docker metadata
81+
id: metadata
82+
uses: docker/metadata-action@v4
83+
with:
84+
images: ${{ env.REGISTRY_IMAGE }}
85+
flavor: |
86+
latest=true
87+
5488
- name: Login to DockerHub
5589
uses: docker/login-action@v2
5690
with:
5791
username: ${{ secrets.DOCKERHUB_USERNAME }}
5892
password: ${{ secrets.DOCKERHUB_TOKEN }}
5993

60-
- name: Combine and Push to DockerHub
61-
uses: docker/build-push-action@v3
62-
with:
63-
context: .
64-
platforms: linux/amd64,linux/arm64
65-
tags: greenden/oracle-core:${{ github.ref_name }}, greenden/oracle-core:latest
66-
push: true
67-
94+
- name: Create manifest list and push
95+
working-directory: /tmp/digests
96+
run: |
97+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
98+
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
99+
- name: Inspect image
100+
run: |
101+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.metadata.outputs.version }}

0 commit comments

Comments
 (0)