feat(ci): add docker image push workflow #8
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
name: Tag and push all docker | |
on: | |
workflow_dispatch: {} | |
pull_request: | |
push: | |
tags: | |
- v* | |
env: | |
CARGO_TERM_COLOR: always | |
DOCKER_USERNAME: ${{ github.actor }} | |
jobs: | |
build: | |
name: Build all images | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run make golang-docker | |
run: | | |
make golang-docker | |
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: 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 }} |