-
Notifications
You must be signed in to change notification settings - Fork 43
156 lines (137 loc) · 5.06 KB
/
release.yml
File metadata and controls
156 lines (137 loc) · 5.06 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
name: Release
on:
push:
tags:
- "v*"
jobs:
build-and-push-images:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- image: skyfloaiagent/engine
dockerfile: deployment/engine/Dockerfile
- image: skyfloaiagent/ui
dockerfile: deployment/ui/Dockerfile
- image: skyfloaiagent/mcp
dockerfile: deployment/mcp/Dockerfile
- image: skyfloaiagent/proxy
dockerfile: deployment/ui/proxy.Dockerfile
- image: skyfloaiagent/k8s-controller
dockerfile: deployment/kubernetes-controller/Dockerfile
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Extract version metadata
id: meta
run: |
TAG="${GITHUB_REF_NAME}"
IS_TEST="false"
if [[ "$TAG" == *"test"* ]]; then
IS_TEST="true"
fi
{
echo "tag=${TAG}"
echo "version=${TAG#v}"
echo "sha_short=${GITHUB_SHA::7}"
echo "is_test=${IS_TEST}"
} >> "$GITHUB_OUTPUT"
- 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 Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Compute image tags
id: tags
run: |
TAGS="${{ matrix.image }}:${{ steps.meta.outputs.tag }}"
TAGS="${TAGS},${{ matrix.image }}:sha-${{ steps.meta.outputs.sha_short }}"
if [ "${{ steps.meta.outputs.is_test }}" != "true" ]; then
TAGS="${TAGS},${{ matrix.image }}:latest"
fi
echo "tags=${TAGS}" >> "$GITHUB_OUTPUT"
- name: Build and push image
uses: docker/build-push-action@v6
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.tags.outputs.tags }}
labels: |
org.opencontainers.image.version=${{ steps.meta.outputs.version }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.source=https://github.com/${{ github.repository }}
build-args: |
APP_VERSION=${{ steps.meta.outputs.version }}
NEXT_PUBLIC_APP_VERSION=${{ steps.meta.outputs.version }}
publish-helm-chart:
runs-on: ubuntu-latest
needs: build-and-push-images
if: needs.build-and-push-images.result == 'success'
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Extract version
id: meta
run: |
TAG="${GITHUB_REF_NAME}"
VERSION="${TAG#v}"
IS_TEST="false"
if [[ "$TAG" == *"test"* ]]; then
IS_TEST="true"
fi
{
echo "version=${VERSION}"
echo "is_test=${IS_TEST}"
} >> "$GITHUB_OUTPUT"
- name: Install Helm
uses: azure/setup-helm@v4
- name: Set chart version
run: |
sed -i "s/^version:.*/version: ${{ steps.meta.outputs.version }}/" charts/skyflo/Chart.yaml
sed -i "s/^appVersion:.*/appVersion: \"${{ steps.meta.outputs.version }}\"/" charts/skyflo/Chart.yaml
- name: Package Helm chart
run: helm package charts/skyflo
- name: Publish to charts.skyflo.ai (GitHub Pages)
if: steps.meta.outputs.is_test != 'true'
env:
CHART_PKG: skyflo-${{ steps.meta.outputs.version }}.tgz
run: |
PAGES_DIR=$(mktemp -d)
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
if git ls-remote --exit-code --heads origin gh-pages >/dev/null 2>&1; then
git clone --single-branch --branch gh-pages \
"https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" \
"$PAGES_DIR"
else
git init "$PAGES_DIR"
git -C "$PAGES_DIR" checkout --orphan gh-pages
git -C "$PAGES_DIR" remote add origin \
"https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git"
fi
cp "$CHART_PKG" "$PAGES_DIR/"
echo "charts.skyflo.ai" > "$PAGES_DIR/CNAME"
if [ -f "$PAGES_DIR/index.yaml" ]; then
helm repo index "$PAGES_DIR" --url https://charts.skyflo.ai --merge "$PAGES_DIR/index.yaml"
else
helm repo index "$PAGES_DIR" --url https://charts.skyflo.ai
fi
cd "$PAGES_DIR"
git add .
if ! git diff --cached --quiet; then
git commit -m "Release skyflo-${{ steps.meta.outputs.version }}"
git push origin gh-pages
else
echo "No changes to commit"
fi