Push Dev and E2E Images to Docker #3188
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
# This workflow pushes new docker images to osmolabs/osmosis-dev and osmolabs/osmosis-e2e-init-chain on these events: | |
# | |
# 1. Every new tag containing a release candidate (e.g. `v1.2.3-rc4`). | |
# `osmolabs/osmosis-dev:1.2.3-rc4` is pushed. | |
# 2. Every new commit to the main branch | |
# `osmolabs/osmosis-dev:main-{SHORT_SHA}-$(date +%s)` is pushed. | |
# 3. Every new commit to a development branch vN.x (e.g. `v1.x`) | |
# `osmolabs/osmosis-dev-v1.x:{SHORT_SHA}-$(date +%s)` is pushed. | |
# | |
# Note: $(date +%s) is used to sort the tags in the docker registry. | |
# | |
# All the images above have support for linux/amd64 (not linux/arm64). | |
# All the images are based on an alpine image for easy debugging. | |
name: Push Dev and E2E Images to Docker | |
on: | |
workflow_dispatch: | |
inputs: | |
ref_name: | |
description: 'Branch or tag name to build from' | |
required: true | |
default: 'main' | |
push: | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ | |
branches: | |
- main | |
- v[0-9]+.x | |
- v[0-9]+.x-iavl-v1 | |
env: | |
RUNNER_BASE_IMAGE_ALPINE: alpine:3.20 | |
OSMOSIS_DEV_IMAGE_REPOSITORY: osmolabs/osmosis-dev | |
OSMOSIS_INIT_CHAIN_IMAGE_REPOSITORY: osmolabs/osmosis-e2e-init-chain | |
OSMOSIS_DEV_IMAGE_COSMOVISOR_REPOSITORY: osmolabs/osmosis-dev-cosmovisor | |
COSMOVISOR_VERSION: v1.5.0 | |
jobs: | |
push-docker-images: | |
runs-on: buildjet-2vcpu-ubuntu-2204 | |
steps: | |
- | |
name: Check out repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.inputs.ref_name || github.ref }} | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Find go version | |
run: | | |
GO_VERSION=$(cat go.mod | grep -E 'go [0-9].[0-9]+' | cut -d ' ' -f 2) | |
echo "GO_VERSION=$GO_VERSION" >> $GITHUB_ENV | |
- | |
name: Create Docker Image Tag for release candidate | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: | | |
GITHUB_TAG=${{ github.event.inputs.ref_name || github.ref_name }} | |
echo "DOCKER_IMAGE_TAG=${GITHUB_TAG#v}" >> $GITHUB_ENV | |
echo "OSMOSIS_VERSION=${{ github.event.inputs.ref_name || github.ref_name }}" >> $GITHUB_ENV | |
- | |
name: Create Docker Image Tag for vN.x branch | |
if: ${{ !startsWith(github.ref, 'refs/tags/v') }} | |
run: | | |
SHORT_SHA=$(echo ${GITHUB_SHA} | cut -c1-8) | |
REF_NAME=${{ github.event.inputs.ref_name || github.ref_name }} | |
SAFE_REF_NAME=${REF_NAME//\//-} | |
echo "DOCKER_IMAGE_TAG=${SAFE_REF_NAME}-${SHORT_SHA}-$(date +%s)" >> $GITHUB_ENV | |
echo "OSMOSIS_VERSION=${SAFE_REF_NAME}-$SHORT_SHA" >> $GITHUB_ENV | |
- | |
name: Build and Push Docker Images | |
uses: docker/build-push-action@v6 | |
with: | |
file: Dockerfile | |
context: . | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
build-args: | | |
GO_VERSION=${{ env.GO_VERSION }} | |
RUNNER_IMAGE=${{ env.RUNNER_BASE_IMAGE_ALPINE }} | |
GIT_VERSION=${{ env.OSMOSIS_VERSION }} | |
GIT_COMMIT=${{ github.sha }} | |
tags: | | |
${{ env.OSMOSIS_DEV_IMAGE_REPOSITORY }}:${{ env.DOCKER_IMAGE_TAG }} | |
- | |
name: Build and Push E2E Init Docker Images | |
uses: docker/build-push-action@v6 | |
with: | |
file: tests/e2e/initialization/init.Dockerfile | |
context: . | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
build-args: | | |
E2E_SCRIPT_NAME=chain | |
tags: | | |
${{ env.OSMOSIS_INIT_CHAIN_IMAGE_REPOSITORY }}:${{ env.DOCKER_IMAGE_TAG }} | |
- | |
name: Build and Push Cosmovisor Docker Images | |
uses: docker/build-push-action@v6 | |
with: | |
file: Dockerfile.cosmovisor | |
context: . | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
build-args: | | |
GO_VERSION=${{ env.GO_VERSION }} | |
RUNNER_IMAGE=${{ env.RUNNER_BASE_IMAGE_ALPINE }} | |
GIT_VERSION=${{ env.OSMOSIS_VERSION }} | |
GIT_COMMIT=${{ github.sha }} | |
COSMOVISOR_VERSION=${{ env.COSMOVISOR_VERSION }} | |
tags: | | |
${{ env.OSMOSIS_DEV_IMAGE_COSMOVISOR_REPOSITORY }}:${{ env.DOCKER_IMAGE_TAG }} |