-
Notifications
You must be signed in to change notification settings - Fork 344
155 lines (139 loc) · 4.8 KB
/
build_apps.yml
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
name: "Build Opik Docker Images"
run-name: "Build ${{ github.ref_name }} by @${{ github.actor }}"
on:
push:
branches:
- 'main'
paths-ignore:
- "deployment/**"
- 'sdks/**'
workflow_dispatch:
inputs:
version:
type: string
required: false
description: Version (optional)
default: ""
push_latest:
type: boolean
description: Push latest tag (optional)
default: false
workflow_call:
inputs:
version:
type: string
required: true
description: Version
default: ""
push_latest:
type: boolean
description: Push latest tag
default: true
jobs:
set-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
build_from: ${{ steps.version.outputs.build_from }}
push_latest: ${{ steps.version.outputs.push_latest }}
steps:
- name: Checkout
uses: actions/[email protected]
- name: Set version
id: version
run: |
if [[ "${{inputs.version}}" != "" ]]; then
VERSION=${{inputs.version}}
else
BASE_VERSION=$(cat version.txt)
BRANCH_NAME="${{ github.ref_name }}"
if [[ "${BRANCH_NAME}" == "main" ]]
then
VERSION=${BASE_VERSION}-${{ github.run_number }}
else
# Normalize branch name
fixedBranchName=$(echo "${BRANCH_NAME}" | sed 's/origin\///; s/\//-/g; s/_/-/g; s/.*/\L&/')
if [ ${#fixedBranchName} -gt 21 ]; then
fixedBranchName="${fixedBranchName:0:20}"
# remove dash at the end
while [ "${fixedBranchName: -1}" = "-" ]; do
fixedBranchName="${fixedBranchName%?}"
done
fi
VERSION="${BASE_VERSION}.${fixedBranchName}-${{ github.run_number }}"
fi
fi
echo "version=${VERSION}" | tee -a $GITHUB_OUTPUT
echo "Version is ${VERSION}" >> $GITHUB_STEP_SUMMARY
if [[ "${{inputs.version}}" == "" ]]; then
echo "build_from=${{github.ref_name}}" | tee -a $GITHUB_OUTPUT
else
echo "build_from=${{inputs.version}}" | tee -a $GITHUB_OUTPUT
fi
if [[ ("${{inputs.version}}" != "" && "${{inputs.push_latest}}" == "true") || "${{ github.ref_name }}" == "main" ]]; then
echo "push_latest=true" | tee -a $GITHUB_OUTPUT
else
echo "push_latest=false" | tee -a $GITHUB_OUTPUT
fi
build-backend:
needs:
- set-version
uses: ./.github/workflows/build_and_push_docker.yaml
with:
image: "opik-backend"
version: ${{needs.set-version.outputs.version}}
build_from: ${{needs.set-version.outputs.build_from}}
build_comet_image: false
comet_build_args: ""
push_latest: ${{needs.set-version.outputs.push_latest}}
build-sandbox-executor-python:
needs:
- set-version
uses: ./.github/workflows/build_and_push_docker.yaml
with:
image: "opik-sandbox-executor-python"
version: ${{needs.set-version.outputs.version}}
build_from: ${{needs.set-version.outputs.build_from}}
build_comet_image: false
comet_build_args: ""
push_latest: ${{needs.set-version.outputs.push_latest}}
build-python-backend:
needs:
- set-version
- build-sandbox-executor-python
uses: ./.github/workflows/build_and_push_docker.yaml
with:
image: "opik-python-backend"
version: ${{needs.set-version.outputs.version}}
build_from: ${{needs.set-version.outputs.build_from}}
build_comet_image: false
comet_build_args: ""
push_latest: ${{needs.set-version.outputs.push_latest}}
build-frontend:
needs:
- set-version
uses: ./.github/workflows/build_and_push_docker.yaml
with:
image: "opik-frontend"
version: ${{needs.set-version.outputs.version}}
build_from: ${{needs.set-version.outputs.build_from}}
build_comet_image: true
comet_build_args: "BUILD_MODE=comet"
push_latest: ${{needs.set-version.outputs.push_latest}}
create-git-tag:
needs:
- set-version
- build-backend
- build-frontend
- build-python-backend
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create git tag
run: |
set -x
git config --local user.email "[email protected]"
git config --local user.name "github-actions"
git tag ${{needs.set-version.outputs.version}}
git push --no-verify origin refs/tags/${{needs.set-version.outputs.version}}