misc defaults, docs, fixes #37
Workflow file for this run
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: Build and Push Appchain-Agent Docker Image | |
on: | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- '**/*.md' | |
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 | |
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 repository | |
uses: actions/checkout@v4 | |
with: | |
path: protokit | |
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=$(cd appchain-agent && 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 | |
context-protokit=./protokit | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
context: ./appchain-agent | |
file: ./appchain-agent/docker/Dockerfile | |
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-protokit=./protokit | |
context: ./appchain-agent | |
file: ./appchain-agent/docker/Dockerfile | |
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 |