Skip to content

Commit 4c4ac72

Browse files
authored
Merge pull request #2 from paradigmxyz/dan/add-docker-push-workflow
feat(ci): add docker image push workflow
2 parents 3392b78 + 51315ee commit 4c4ac72

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

.github/workflows/docker-push.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Tag and push all docker
2+
3+
on:
4+
workflow_dispatch: {}
5+
push:
6+
tags:
7+
- v*
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
DOCKER_USERNAME: ${{ github.actor }}
12+
13+
jobs:
14+
build:
15+
name: Build all images
16+
runs-on: ubuntu-20.04
17+
permissions:
18+
packages: write
19+
contents: read
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Run make golang-docker
23+
run: |
24+
make golang-docker
25+
26+
- name: Put all docker images in temp dir
27+
run: |
28+
docker image ls | grep 'us-.*oplabs.*latest' | sed 's/ *latest.*//' | xargs -L1 -I % echo 'docker image save % -o /tmp/%.tar' | sed 's:/tmp/.*/\(.*\.tar\):/tmp/\1:' | bash
29+
30+
- name: Upload artifact
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: op-images
34+
path: /tmp/op-*.tar
35+
36+
push:
37+
name: Tag and push all images
38+
runs-on: ubuntu-20.04
39+
needs: build
40+
strategy:
41+
matrix:
42+
image: [op-node, op-batcher, op-proposer, op-challenger, op-supervisor, op-dispute-mon]
43+
permissions:
44+
packages: write
45+
contents: read
46+
steps:
47+
- name: Download built artifact
48+
uses: actions/download-artifact@v4
49+
with:
50+
name: op-images
51+
path: op-images
52+
53+
- name: Import image
54+
run: |
55+
docker image load --input op-images/${{ matrix.image }}.tar
56+
57+
- name: Log in to Docker
58+
run: |
59+
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io --username ${DOCKER_USERNAME} --password-stdin
60+
61+
- name: Tag image versions
62+
run: |
63+
docker image tag us-docker.pkg.dev/oplabs-tools-artifacts/images/${{ matrix.image }} ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}
64+
65+
- name: Tag versions
66+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
67+
run: |
68+
docker image tag ghcr.io/${{ github.repository_owner }}/${{ matrix.image }} ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}:${{ github.ref_name }}
69+
70+
- name: Push images
71+
run: |
72+
docker image push -a ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}

0 commit comments

Comments
 (0)