-
Notifications
You must be signed in to change notification settings - Fork 158
153 lines (144 loc) · 5.98 KB
/
release.yml
File metadata and controls
153 lines (144 loc) · 5.98 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
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
beeai-platform:
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
- uses: ./.github/actions/setup
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Set up QEMU" # required by [beeai-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 'beeai-server:build:*'
- uses: docker/build-push-action@v6
with:
context: ./apps/beeai-server
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository }}/beeai-server:${{ github.sha }}
ghcr.io/${{ github.repository }}/beeai-server:${{ steps.version.outputs.version }}
ghcr.io/${{ github.repository }}/beeai-server:${{ steps.version.outputs.latestTag }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/beeai-server:cache
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/beeai-server:cache,mode=max
- run: mise run 'beeai-ui:build:*'
- uses: docker/build-push-action@v6
with:
context: .
file: ./apps/beeai-ui/Dockerfile
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ github.repository }}/beeai-ui:${{ github.sha }}
ghcr.io/${{ github.repository }}/beeai-ui:${{ steps.version.outputs.version }}
ghcr.io/${{ github.repository }}/beeai-ui:${{ steps.version.outputs.latestTag }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/beeai-ui:cache
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}/beeai-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/beeai-platform-*.tgz 'oci://ghcr.io/${{ github.repository }}/beeai-platform-chart'
- run: mise run beeai-sdk:build
- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: apps/beeai-sdk/dist
- run: mise run beeai-cli:build
- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: apps/beeai-cli/dist