Skip to content

build: use local path to protokit dependency #27

build: use local path to protokit dependency

build: use local path to protokit dependency #27

Workflow file for this run

name: Build and Push Appchain-Agent Docker Image
on:
pull_request:
branches:
- main
push:
branches:
- main
paths-ignore:
- '**/*.md'
tags:
- "v*"
permissions:
contents: read
packages: write
jobs:
build-push-docker-image:
runs-on: ubuntu-latest
env:
APPCHAIN_REPO: ${{ github.repository_owner }}/appchain
PROTOKIT_REPO: ${{ github.repository_owner }}/protokit-framework
IMAGE: ghcr.io/${{ github.repository_owner }}/appchain-agent
IMAGE_TEST: zkn/appchain-agent
steps:
- name: Checkout appchain-agent repository
uses: actions/checkout@v4
with:
path: appchain-agent
- name: Read dependencies versions
run: |
source appchain-agent/deps.env
echo "APPCHAIN_REF=${APPCHAIN}" >> $GITHUB_ENV
echo "PROTOKIT_REF=${PROTOKIT}" >> $GITHUB_ENV
- name: Checkout appchain repository
uses: actions/checkout@v4
with:
path: appchain
ref: ${{ env.APPCHAIN_REF }}
repository: ${{ env.APPCHAIN_REPO }}
ssh-key: ${{ secrets.APPCHAIN_DEPLOY_KEY }}
- name: Checkout protokit-framework repository
uses: actions/checkout@v4
with:
path: protokit-framework
ref: ${{ env.PROTOKIT_REF }}
repository: ${{ env.PROTOKIT_REPO }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.IMAGE }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
type=sha
# https://docs.docker.com/build/ci/github-actions/reproducible-builds/
- name: Set source build date from git commit timestamp
run: echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
- name: Build and export to Docker
uses: docker/build-push-action@v6
env:
DOCKER_BUILD_SUMMARY: false
with:
build-contexts: |
context-appchain=./appchain
cache-from: type=gha
cache-to: type=gha,mode=max
context: ./appchain-agent
tags: ${{ env.IMAGE_TEST }}:test
load: true
- name: Test docker image
run: docker run --rm ${{ env.IMAGE_TEST }}:test pnpm run agent --help
- name: Docker build and push
uses: docker/build-push-action@v6
with:
build-contexts: |
context-appchain=./appchain
context: ./appchain-agent
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
push: ${{ github.event_name != 'pull_request' }}
- name: List docker images
run: docker images