forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from paradigmxyz/dan/add-docker-push-workflow
feat(ci): add docker image push workflow
- Loading branch information
Showing
1 changed file
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |