Skip to content

chore: add ki

chore: add ki #12

Workflow file for this run

name: docker
on:
push:
branches:
- "master"
jobs:
docker:
strategy:
matrix:
chain:
# TODO: make it dynamic
- axone
- chihuahua
- govgen
- juno
- ki
- nolus
continue-on-error: true
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
cache: true
cache-dependency-path: "**/build.yaml"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Go Build Cache for Docker
uses: actions/cache@v4
with:
path: |
go-build-cache
go-mod-cache
key: ${{ runner.os }}-go-build-cache-${{ hashFiles('**/build.yaml') }}
restore-keys: |
${{ runner.os }}-go-build-cache
- name: inject go-cache into docker
uses: reproducible-containers/[email protected]
with:
cache-map: |
{
"go-build-cache": "/root/.cache/go-build",
"go-mod-cache": "/go/pkg/mod"
}
- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get version
id: version
uses: mikefarah/yq@master
with:
cmd: yq -r '.version' './${{ matrix.chain }}/build.yaml'
- name: Get go_version
id: go_version
uses: mikefarah/yq@master
with:
cmd: yq -r '.go_version' './${{ matrix.chain }}/build.yaml'
- name: Get chain_repository
id: chain_repository
uses: mikefarah/yq@master
with:
cmd: yq -r '.chain_repository' './${{ matrix.chain }}/build.yaml'
- name: Get daemon_name
id: daemon_name
uses: mikefarah/yq@master
with:
cmd: yq -r '.daemon_name' './${{ matrix.chain }}/build.yaml'
- name: Get daemon_home
id: daemon_home
uses: mikefarah/yq@master
with:
cmd: yq -r '.daemon_home' './${{ matrix.chain }}/build.yaml'
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}/${{ matrix.chain }}
tags: |
type=raw,value=latest
type=raw,value=${{ steps.version.outputs.result }}
- name: Check if image already exist
id: image_exists
continue-on-error: true
uses: cloudposse/[email protected]
with:
image_name: "${{ github.repository }}/${{ matrix.chain }}"
registry: ghcr.io
tag: "${{ steps.version.outputs.result }}"
# TODO: Check if the directory have a custom Dockerfile
# in that case, build a different image
- name: Build and push
uses: docker/build-push-action@v3
if: "steps.image_exists.outcome == 'failure'"
with:
file: "./Dockerfile"
context: ./${{ matrix.chain }}
build-args: |
CHAIN_NAME=${{ matrix.chain }}
VERSION=${{ steps.version.outputs.result }}
GO_VERSION=${{ steps.go_version.outputs.result }}
CHAIN_REPO=${{ steps.chain_repository.outputs.result }}
DAEMON_NAME=${{ steps.daemon_name.outputs.result }}
DAEMON_HOME=${{ steps.daemon_home.outputs.result }}
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}