Skip to content

Commit

Permalink
Merge pull request #2 from paradigmxyz/dan/add-docker-push-workflow
Browse files Browse the repository at this point in the history
feat(ci): add docker image push workflow
  • Loading branch information
Rjected authored Sep 25, 2024
2 parents 3392b78 + 51315ee commit 4c4ac72
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/docker-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Tag and push all docker

on:
workflow_dispatch: {}
push:
tags:
- v*

env:
CARGO_TERM_COLOR: always
DOCKER_USERNAME: ${{ github.actor }}

jobs:
build:
name: Build all images
runs-on: ubuntu-20.04
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Run make golang-docker
run: |
make golang-docker
- name: Put all docker images in temp dir
run: |
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
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: op-images
path: /tmp/op-*.tar

push:
name: Tag and push all images
runs-on: ubuntu-20.04
needs: build
strategy:
matrix:
image: [op-node, op-batcher, op-proposer, op-challenger, op-supervisor, op-dispute-mon]
permissions:
packages: write
contents: read
steps:
- name: Download built artifact
uses: actions/download-artifact@v4
with:
name: op-images
path: op-images

- name: Import image
run: |
docker image load --input op-images/${{ matrix.image }}.tar
- name: Log in to Docker
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io --username ${DOCKER_USERNAME} --password-stdin
- name: Tag image versions
run: |
docker image tag us-docker.pkg.dev/oplabs-tools-artifacts/images/${{ matrix.image }} ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}
- name: Tag versions
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: |
docker image tag ghcr.io/${{ github.repository_owner }}/${{ matrix.image }} ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}:${{ github.ref_name }}
- name: Push images
run: |
docker image push -a ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}

0 comments on commit 4c4ac72

Please sign in to comment.