Skip to content

Commit 26260a9

Browse files
committed
add hermes ci
1 parent 5b30cd7 commit 26260a9

1 file changed

Lines changed: 100 additions & 0 deletions

File tree

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Hermes image
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
image:
7+
description: Docker image name to push
8+
required: false
9+
default: nativeplanet/hermes-tlon
10+
hermes_agent_ref:
11+
description: Hermes Agent git ref
12+
required: false
13+
default: 2ffa1c97c09317c1d066aa5708b8ad961a4ca589
14+
tlon_apps_ref:
15+
description: tlon-apps git ref
16+
required: false
17+
default: b9180da6491d29933a98f6e4f1b1458ce61ca576
18+
push:
19+
description: Push image to Docker Hub
20+
required: false
21+
type: boolean
22+
default: true
23+
push:
24+
branches:
25+
- main
26+
- master
27+
paths:
28+
- containers/hermes/**
29+
- .github/workflows/hermes-image.yaml
30+
pull_request:
31+
paths:
32+
- containers/hermes/**
33+
- .github/workflows/hermes-image.yaml
34+
35+
permissions:
36+
contents: read
37+
38+
env:
39+
DEFAULT_IMAGE: nativeplanet/hermes-tlon
40+
HERMES_IMAGE_TAG: 0.14.0-0.13.0
41+
HERMES_AGENT_REF: 2ffa1c97c09317c1d066aa5708b8ad961a4ca589
42+
TLON_APPS_REF: b9180da6491d29933a98f6e4f1b1458ce61ca576
43+
44+
jobs:
45+
build:
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@v4
49+
50+
- id: args
51+
name: Resolve build arguments
52+
run: |
53+
set -euo pipefail
54+
image="${{ github.event.inputs.image }}"
55+
hermes_ref="${{ github.event.inputs.hermes_agent_ref }}"
56+
tlon_ref="${{ github.event.inputs.tlon_apps_ref }}"
57+
push_image="true"
58+
59+
if [ -z "$image" ]; then image="$DEFAULT_IMAGE"; fi
60+
if [ -z "$hermes_ref" ]; then hermes_ref="$HERMES_AGENT_REF"; fi
61+
if [ -z "$tlon_ref" ]; then tlon_ref="$TLON_APPS_REF"; fi
62+
if [ "${{ github.event_name }}" = "pull_request" ]; then
63+
push_image="false"
64+
elif [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ github.event.inputs.push }}" != "true" ]; then
65+
push_image="false"
66+
fi
67+
68+
echo "image=$image" >> "$GITHUB_OUTPUT"
69+
echo "hermes-ref=$hermes_ref" >> "$GITHUB_OUTPUT"
70+
echo "tlon-ref=$tlon_ref" >> "$GITHUB_OUTPUT"
71+
echo "push=$push_image" >> "$GITHUB_OUTPUT"
72+
73+
- name: Set up QEMU
74+
uses: docker/setup-qemu-action@v3
75+
76+
- name: Set up Docker Buildx
77+
uses: docker/setup-buildx-action@v3
78+
79+
- name: Log in to Docker Hub
80+
if: steps.args.outputs.push == 'true'
81+
uses: docker/login-action@v3
82+
with:
83+
username: ${{ secrets.DOCKERHUB_USERNAME }}
84+
password: ${{ secrets.DOCKERHUB_TOKEN }}
85+
86+
- name: Build Hermes image
87+
uses: docker/build-push-action@v6
88+
with:
89+
context: containers/hermes
90+
file: containers/hermes/Dockerfile
91+
platforms: linux/amd64,linux/arm64
92+
push: ${{ steps.args.outputs.push == 'true' }}
93+
build-args: |
94+
HERMES_AGENT_REF=${{ steps.args.outputs.hermes-ref }}
95+
TLON_APPS_REF=${{ steps.args.outputs.tlon-ref }}
96+
tags: |
97+
${{ steps.args.outputs.image }}:${{ env.HERMES_IMAGE_TAG }}
98+
${{ steps.args.outputs.image }}:${{ env.HERMES_IMAGE_TAG }}-${{ github.sha }}
99+
cache-from: type=gha
100+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)