-
Notifications
You must be signed in to change notification settings - Fork 156
173 lines (162 loc) · 6.88 KB
/
release.yml
File metadata and controls
173 lines (162 loc) · 6.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: read
packages: write
id-token: write
jobs:
agents:
runs-on: ubuntu-latest
environment: release
strategy:
matrix:
agent:
- chat
- rag
- form
steps:
- uses: actions/checkout@v4
- id: version
run: |
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
echo "latestTag=$([[ ${GITHUB_REF#refs/tags/v} =~ [a-zA-Z] ]] && echo prerelease || echo latest)" >> $GITHUB_OUTPUT
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v5
with:
context: .
file: ./agents/${{ matrix.agent }}/Dockerfile
push: false
load: true
build-args: |
RELEASE_VERSION=${{ github.ref_name }}
tags: tmp-agent-image
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/agents/${{ matrix.agent }}:cache
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/agents/${{ matrix.agent }}:cache,mode=max
- id: agent-manifest
run: |
set -e
docker run -d --rm --name=tmp-agent -p 8000:8000 -e HOST=0.0.0.0 -e PORT=8000 tmp-agent-image
success=0
for i in {1..30}; do
echo "Extracting manifest: attempt $i"
response=$(curl http://localhost:8000/.well-known/agent-card.json 2>/dev/null) && success=1 && break
sleep 0.5
done
[[ "$success" == 1 ]] || (echo "Failed to discover agents" && exit 1)
docker kill tmp-agent
AGENT_MANIFEST=$(echo "$response" | base64 -w 0)
echo "content=$AGENT_MANIFEST" >> $GITHUB_OUTPUT
- uses: docker/build-push-action@v5
with:
context: .
file: ./agents/${{ matrix.agent }}/Dockerfile
push: true
platforms: linux/amd64,linux/arm64
build-args: |
RELEASE_VERSION=${{ github.ref_name }}
tags: |
ghcr.io/${{ github.repository }}/agents/${{ matrix.agent }}:${{ github.sha }}
ghcr.io/${{ github.repository }}/agents/${{ matrix.agent }}:${{ steps.version.outputs.version }}
ghcr.io/${{ github.repository }}/agents/${{ matrix.agent }}:${{ steps.version.outputs.latestTag }}
labels: |
beeai.dev.agent.json=${{ steps.agent-manifest.outputs.content }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/agents/${{ matrix.agent }}:cache
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/agents/${{ matrix.agent }}:cache,mode=max
agentstack:
needs: agents
runs-on: ubuntu-latest
environment: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HELM_EXPERIMENTAL_OCI: '1'
steps:
- uses: actions/checkout@v4
- id: version
run: |
echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
echo "latestTag=$([[ ${GITHUB_REF#refs/tags/v} =~ [a-zA-Z] ]] && echo prerelease || echo latest)" >> $GITHUB_OUTPUT
VERSION="${GITHUB_REF#refs/tags/v}"
if [[ "$VERSION" =~ [Rr][Cc] ]]; then
echo "npmTag=rc" >> $GITHUB_OUTPUT
else
echo "npmTag=latest" >> $GITHUB_OUTPUT
fi
- uses: ./.github/actions/setup
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Set up QEMU" # required by [agentstack-cli:build]
id: "setup-qemu"
shell: bash
run: |
set -eux -o pipefail
[ "$(uname)" = "Linux" ]
[ "$(uname -m)" = "x86_64" ]
sudo apt-get update -qq
sudo apt-get install -qqy --no-install-recommends ovmf qemu-system-x86 qemu-utils
sudo modprobe kvm
# `sudo usermod -aG kvm $(whoami)` does not take an effect on GHA
sudo chown $(whoami) /dev/kvm
- run: mise run common:check:version
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: mise run 'agentstack-server:build:*'
- uses: docker/build-push-action@v6
with:
context: ./apps/agentstack-server
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository }}/agentstack-server:${{ github.sha }}
ghcr.io/${{ github.repository }}/agentstack-server:${{ steps.version.outputs.version }}
ghcr.io/${{ github.repository }}/agentstack-server:${{ steps.version.outputs.latestTag }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/agentstack-server:cache
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/agentstack-server:cache,mode=max
- uses: docker/build-push-action@v6
with:
context: ./apps/supergateway
file: ./apps/supergateway/Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: ghcr.io/${{ github.repository }}/supergateway:latest
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/supergateway:cache
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/supergateway:cache,mode=max
- run: mise run 'agentstack-ui:build:*'
- uses: docker/build-push-action@v6
with:
context: .
file: ./apps/agentstack-ui/Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository }}/agentstack-ui:${{ github.sha }}
ghcr.io/${{ github.repository }}/agentstack-ui:${{ steps.version.outputs.version }}
ghcr.io/${{ github.repository }}/agentstack-ui:${{ steps.version.outputs.latestTag }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/agentstack-ui:cache
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/agentstack-ui:cache,mode=max
- run: mise run helm:build
- run: echo '${{ secrets.GITHUB_TOKEN }}' | helm registry login --username '${{ github.actor }}' --password-stdin ghcr.io
- run: helm push ./helm/dist/agentstack-*.tgz 'oci://ghcr.io/${{ github.repository }}/chart'
- run: mise run agentstack-sdk-py:build
- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: apps/agentstack-sdk-py/dist
- run: mise run agentstack-cli:build
- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: apps/agentstack-cli/dist
- name: Publish TS SDK
working-directory: apps/agentstack-sdk-ts
run: npm publish --tag ${{ steps.version.outputs.npmTag }}