Skip to content

Commit 8f2d343

Browse files
authored
cicd: push container images to ghcr as well (#356)
* feat: push images to ghcr refs L2P-714 * feat: push releases to ghcr closes L2P-714
1 parent 18737f4 commit 8f2d343

File tree

2 files changed

+54
-8
lines changed

2 files changed

+54
-8
lines changed

.github/workflows/build.yml

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ jobs:
5454
- name: Set up Docker Buildx
5555
uses: docker/setup-buildx-action@v3
5656

57-
- name: Login to DockerHub
57+
- name: Login to Docker Hub
5858
uses: docker/login-action@v3
5959
with:
6060
username: ${{ secrets.FLASHBOTS_DOCKERHUB_USERNAME }}
6161
password: ${{ secrets.FLASHBOTS_DOCKERHUB_TOKEN }}
6262

63-
- name: Build and push
63+
- name: Build and push to docker hub
6464
id: build
6565
uses: docker/build-push-action@v6
6666
with:
@@ -69,9 +69,10 @@ jobs:
6969
context: .
7070
platforms: ${{ matrix.config.platform }}
7171
labels: ${{ steps.meta.outputs.labels }}
72+
outputs: type=registry,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true
7273
build-args: |
7374
SERVICE_NAME=${{ inputs.service_name || 'rollup-boost' }}
74-
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
75+
outputs: type=registry,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true
7576

7677
- name: Export digest
7778
run: |
@@ -89,6 +90,9 @@ jobs:
8990

9091
merge:
9192
runs-on: warp-ubuntu-latest-x64-16x
93+
permissions:
94+
contents: read
95+
packages: write
9296
needs:
9397
- build
9498
steps:
@@ -105,6 +109,13 @@ jobs:
105109
username: ${{ secrets.FLASHBOTS_DOCKERHUB_USERNAME }}
106110
password: ${{ secrets.FLASHBOTS_DOCKERHUB_TOKEN }}
107111

112+
- name: Login to GHCR
113+
uses: docker/login-action@v3
114+
with:
115+
registry: ghcr.io
116+
username: ${{ github.actor }}
117+
password: ${{ secrets.FLASHBOTS_GHCR_TOKEN }}
118+
108119
- name: Set up Docker Buildx
109120
uses: docker/setup-buildx-action@v3
110121

@@ -120,8 +131,22 @@ jobs:
120131
- name: Create manifest list and push
121132
working-directory: /tmp/digests
122133
run: |
123-
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
124-
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
134+
image=$(
135+
jq -cr '.tags | first' <<< "$DOCKER_METADATA_OUTPUT_JSON"
136+
)
137+
138+
docker buildx imagetools create -t $image $(
139+
printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *
140+
)
141+
142+
- name: Install regctl
143+
uses: regclient/actions/regctl-installer@main
144+
145+
- name: Push to GHCR
146+
run: |
147+
regctl image copy \
148+
${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} \
149+
ghcr.io/${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
125150
126151
- name: Inspect image
127152
run: |

.github/workflows/release.yml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
VERSION=${{ env.RELEASE_VERSION }}
6868
platforms: ${{ matrix.config.platform }}
6969
labels: ${{ steps.meta.outputs.labels }}
70-
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
70+
outputs: type=registry,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true
7171

7272
- name: Export digest
7373
run: |
@@ -101,6 +101,13 @@ jobs:
101101
username: ${{ secrets.FLASHBOTS_DOCKERHUB_USERNAME }}
102102
password: ${{ secrets.FLASHBOTS_DOCKERHUB_TOKEN }}
103103

104+
- name: Login to GHCR
105+
uses: docker/login-action@v3
106+
with:
107+
registry: ghcr.io
108+
username: ${{ github.actor }}
109+
password: ${{ secrets.FLASHBOTS_GHCR_TOKEN }}
110+
104111
- name: Set up Docker Buildx
105112
uses: docker/setup-buildx-action@v3
106113

@@ -118,8 +125,22 @@ jobs:
118125
- name: Create manifest list and push
119126
working-directory: /tmp/digests
120127
run: |
121-
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
122-
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
128+
image=$(
129+
jq -cr '.tags | first' <<< "$DOCKER_METADATA_OUTPUT_JSON"
130+
)
131+
132+
docker buildx imagetools create -t $image $(
133+
printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *
134+
)
135+
136+
- name: Install regctl
137+
uses: regclient/actions/regctl-installer@main
138+
139+
- name: Push to GHCR
140+
run: |
141+
regctl image copy \
142+
${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} \
143+
ghcr.io/${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
123144
124145
- name: Inspect image
125146
run: |

0 commit comments

Comments
 (0)